Carl Edwards came on late to win Sunday night's crash-filled Bojangles' Southern 500 on a throwback Labor Day weekend at historic Darlington Raceway.

In a great three-way battle over the closing laps, Edwards used a lightning fast final pit stop to take the lead. He then held off 2012 NASCAR Sprint Cup Series champion Brad Keselowski and Edwards' Joe Gibbs Racing teammate Denny Hamlin to win his second race of the season and 25th of his career.

Joey Logano and defending Cup champion Kevin Harvick completed the top five.

More from FoxSports

Edwards came back from two laps down after an early flat tire to earn the 10th victory of the season in 25 races for JGR, tops in the Cup Series. It was also the 75th career Cup victory for automaker Toyota.

The race featured NASCAR's low-downforce aerodynamic package, with a softer tire. The combination produced some sensational racing and a record number of cautions.

"I don't think I can get in trouble for saying how much I liked it," said Edwards of NASCAR's aero package. "But, man, I loved it. This is as good as it gets. This is what it's about. We're sliding cars, the tires are falling off. This is the style of racing that I love. If there's any chance we can run this in the Chase, I hope we can do it. Just an awesome day."

"I was happy with third, considering where we were with about 20 or 30 laps to go," said third-place finisher Hamlin.

Edwards' victory was something of a surprise, as Keselowski dominated, leading 196 of 367 laps.

Afterward, Keselowski was philosophical about not being able to seal the deal..

"We're not that far off and that feels good," he said. "Just a few little things."

Keselowski started from the pole in his Team Penske Ford and took the lead at the start over Harvick's Stewart-Haas Racing Chevrolet.

The Penske Ford dominated the first half of the race. At Lap 184, the halfway point of he night, Keselowski had led 127 laps and was in front of SHR teammates Kurt Busch and Harvick.

On a restart on Lap 203, Busch passed Keselowski to take his first lead of the night.

After another caution, Tony Stewart and Kyle Larson stayed out while most of the rest of the leaders pitted, with the three-time champion taking the lead on the Lap 212 restart.

But on old tires, Stewart was a sitting duck, and Hamlin passed him for the lead on Lap 222.

Seven laps later, Chase Elliott crashed to bring out another yellow, with Harvick winning the race off pit road.

The crashes continued to mount as the race neared the three-quarter mark.

At the 300-lap mark, Harvick was still in the lead, ahead of Keselowski and Busch.

Then, a caution for debris sent the field down pit road again, Keselowski this time coming out first and Harvick moving to second past Busch on the restart.

But Busch then got nudged by Martin Truex Jr. and spun as the track went yellow for the 17th time, tying a race record.

On the restart, Keselowski and Harvick pulled away, waging a tremendous fight for the lead.

With 35 laps to go, Edwards passed Harvick for second and set out after Keselowski. Twelve laps later, Edwards tried to pass Keselowski but couldn't make the pass stick and wound up losing second to Harvick.

Then, with 13 laps to go, Jeb Burton spun to bring out the record 18th caution.

Edwards won the race off pit road, and as is so often the case in NASCAR these days, that was the difference in the race.

With eight laps left, Edwards and Hamlin broke into the lead on the restart over Keselowski, with Logano fourth and Harvick fifth. And although Keselowski was able to take second, Edwards cruised to the victory.