Denny Hamlin survived a green-white-checkered finish to win Sunday night’s AdvoCare 500 at Atlanta Motor Speedway and establish himself as the NASCAR Sprint Cup championship favorite.

Martin Truex Jr. passed Hamlin with 43 laps to go and appeared headed for his first victory since June 2007.

But Jamie McMurray crashed on Lap 320 of the 325-lap scheduled race to set up a green-white-checkered finish. Under caution, the lead-lap cars all pitted, and Hamlin won the race off pit road. He then made a great restart.

“Our car faded a little bit, but our pit crew won us the race,” said Hamlin. “That’s what championships are all about.”

In the process, Hamlin won his second consecutive race and moved into the No. 1 seed in the Chase for the Sprint Cup, as he is the only driver with four race victories.

“I don’t have to say anything,” Hamlin said. “Our wins say it all.”

Jeff Gordon finished second in his No. 24 Hendrick Motorsports Chevrolet ahead of Brad Keselowski, Truex and Kevin Harvick.

Gordon said he made a bad final restart and indicated he would have put the bumper to Hamlin had he had the opportunity. “I wish I had that one to do over again,” said Gordon. “… What a battle. You know going into this race that it’s going to be a fight. … I’m just mad at myself right now. I guess I’m just getting soft in my old age. I’m too nice. Fifteen years ago, I would have moved him (Hamlin) up the race track.”

“Just a solid night,” said third-place Keselowski. “We had a car that was a pleasant surprise … we had a strong, consistent night.”

Tony Stewart started from the pole, but quickly fell back after the green, with Kyle Busch and Denny Hamlin running 1-2 by Lap 17.

Once out front, the two Joe Gibbs Racing Toyotas pulled out smartly, with Busch leading third-place Jeff Gordon by 5 seconds on Lap 30. Five laps later, it was Hamlin passing Busch for the lead.

At the 100-lap mark, the order was Hamlin, Busch, Kevin Harvick, Jimmie Johnson and Jeff Gordon.

Harvick soon was up to second place, but Hamlin was on fire, and by Lap 115, just 14 cars were on the lead lap.

A caution on Lap 131 bunched the field, with Harvick making a great restart on Lap 135 to go ahead for the first time. The clean air was a huge help as Harvick quickly stretched his margin to 2.526 seconds over Hamlin on Lap 155.

At the halfway point, Harvick led Hamlin, Martin Truex Jr., Busch and Sam Hornish Jr.

Harvick continued to strongly up front, but around the lap-225 mark, Hamlin began to run down the race-leading Chevrolet. At one point, Harvick led by more than 6 seconds, but Hamlin narrowed the gap to less than half a second by Lap 235.

Eight laps later, a caution flag flew after Juan Pablo Montoya hit the wall, with the yellow sending the leaders down pit road. Hamlin won the race off pit road over Harvick and Busch, putting the No. 11 Toyota back out front after Harvick had led more than 100 laps.

The race restarted on Lap 248, Hamlin and Harvick battling each other hard for the top spot, but Truex quickly displacing Harvick for second as Hamlin pulled away.

Truex caught Hamlin and was about to pass him on Lap 265, when Carl Edwards lost an engine and the yellow flew again. He is now realistically out of contention to make this year’s Chase for the Sprint Cup.

On the Lap 270 restart, Jimmie Johnson and Sam Hornish Jr. made contact and crashed on the backstretch, taking Ryan Newman with them and likely ending Newman’s wild-card hopes.

Under the caution, leaders Hamlin and Truex didn’t pit, nor did Busch or Matt Kenseth, but everyone behind them came in.

The race restarted on Lap 280, with Hamlin and Truex pulling away from the pack. Truex went under Hamlin on the backstretch to take his first lead of the night on Lap 282.

Gordon, who had been quiet through the middle stages of the race after a slow pit stop, passed Hamlin for second place on Lap 292. Still, Truex had a lead of 2.506 seconds at this point, a seemingly safe margin.

But on Lap 320, Jamie McMurray lost a tire and brought out a caution, sending the field down pit road one last time.

Hamlin won the race off pit road, setting up a green-white-checkered finish. From there, he got a great restart and cruised to victory.

Tom Jensen is the Editor in Chief of SPEED.com, Senior NASCAR Editor at RACER and a contributing Editor for TruckSeries.com. You can follow him online at twitter.com/tomjensen100.