Denny Hamlin was in the right place at the right time and, as a result, won the Aaron's 499 at Talladega Superspeedway on Sunday.

Hamlin was out front when the final yellow flag of the day was waved with less than a half a lap to go because of debris in the middle of the track on the front stretch.

Greg Biffle and Clint Bowyer were waiting to make their move, but the caution lights ended their victory hopes as Hamlin was able to cruise to his first win of the season and the 24th of his career and the first at a restrictor-plate race.

Hamlin was the leader when the green flag came out for the final time with two laps to go. Kevin Harvick was second on the restart. But Harvick's victory hopes were eliminated when he tried to block the third lane being formed by Landon Cassill. Harvick had to get out of the gas to keep Cassill from hitting him and lost all his momentum.

This left Biffle in second place with Bowyer on his bumper.

As the front pack was given the white flag, rookie Justin Allgaier spun just before the start-finish line with a huge piece of debris flying off his car and coming to rest on the tri-oval.

The caution came out a few seconds later to hand the victory to Hamlin.

Brian Vickers finished fourth followed by A.J. Allmendinger, Paul Menard, Harvick, Kasey Kahne, Kyle Larson and Ricky Stenhouse, Jr.

"I knew that there was a wreck somewhere around the start-finish line and I knew that we just had to keep in it (the gas)," said Hamlin. "NASCAR did a good job of just letting the race play out as long as it was able to safely.

"We knew we were in a good spot to get a victory (on the final restart). It was just a matter of which line was going to get the push -- was it going to be the outside or inside. I thought my best chance was to stay on the inside, usually the outside lane gets jumbled up with guys trying to stick it three-wide. I chose the bottom and it was the right decision.

The victory enabled Hamlin to move up two spots in the Sprint Cup standings to 12th as he becomes the eighth different driver to win a race in 2014 -- the year where a win all but guarantees a driver a spot in the Chase for the Championship.

Biffle, who led a race-high 58 laps, was hoping NASCAR would allow the race to go the full distance.

"I looked in the mirror and saw the smoke behind me and I wasn't really sure whether the caution was gonna come out and I didn't know what to do and I thought about making a move on the 11 (Hamlin) right then because I had a huge run and I could have, but I just didn't want to pass too early," said Biffle. "So I was just waiting. I was backing off of him quite a bit on the backstretch and they said, 'caution is out.' I was setting up to go by him, but just never had the chance. I wish I had known we weren't gonna race all the way back, but it was a good day for us. The car was really fast, had a lot of speed, and I'm just happy to come out of here with a clean car."

Bowyer, who spent the first 150 laps in the back of the pack, said the decision to lay back "was all about being there at the end and going for broke at the end. We did that, we got up in position (to challenge for the win) and everything was going right, and it's just like Greg said, you're kind of damned if you do, damned if you don't.

"I liked the situation that I was in for sure. I knew Greg was going to try something. It's just frustrating because of the simple fact that we both thought we had an opportunity to pounce and make a move for the win. But NASCAR did the right thing. You can't put people in danger right there."

The first 137 laps of the race were slowed by only three caution flags.

NOTES: Marcos Ambrose was fined $25,000 and put on probation by NASCAR for punching Casey Mears following the Richmond race. "I don't apologize for my actions," said Ambrose. "I was just standing up for myself and my team and my family and letting people know that you can't get in my private space like that and expect to not have any consequences." ... The 20th anniversary of the Kyle Petty Charity Ride across America began Saturday from Carlsbad, Calif. More than 175 riders will travel more than 2,800 miles before reaching Daytona Beach, Fla., on May 10. The Ride raises funds and awareness for the Victory Junction camp which was created to enrich the lives of children with chronic or life threatening illnesses. "What began as just a few friends having a good time riding track to track has turned into what we have today, which is an incredible event that provides thousands of life changing experiences for children," said Petty.