Stewart's No. 20 Joe Gibbs Racing Toyota held off Regan Smith (Chevrolet) in a green-white-checkered finish.
Smith crossed the finish line ahead of Stewart, but NASCAR ruled he passed Stewart below the yellow line, an illegal move, coming out of turn four, and awarded the two-time Cup champion the win.
"I was told the rule is that if you're forced down there you're the winner and on the last lap anything goes," Smith said about the ruling.
"It's one thing to get back to victory lane, but to do it to Talladega," Stewart said after his first win ever at NASCAR's toughest racetrack.
The victory was Stewart's first this season and the 33rd of his career.
Paul Menard, David Ragan and Jeff Burton completed the top five finishers.
In the latest "Race for the Chase" standings, Jimmie Johnson is first, Carl Edwards second and Greg Biffle third.
2014: The Year in Music [PHOTOS]