INDIANAPOLIS (AP) -- Kasey Kahne survived a crash-marred Brickyard 400 on Sunday for his first NASCAR Cup victory in nearly three years.
The Hendrick Motorsports driver won under caution in the race that took more than six hours to complete, finally finishing in fading light after 167 laps and double overtime.
Brad Keselowski was second.
Afterward, Kahne went to Indianapolis Motor Speedway's infield medical center. Series officials didn't say what he was being treated for but other drivers said the temperatures inside the cars topped 130 degrees.
— NASCAR (@NASCAR) July 24, 2017
It was a wild day at Indianapolis Motor Speedway with Kyle Busch and Martin Truex Jr. - driving the two fastest cars - going out in a crash with 49 laps to go.
That was only a prelude the nutty final 20 laps that included five crashes, two of which brought out red flags.
Busch looked as if he would make history as the first driver to win three consecutive Brickyards when he led the first 71 laps - and 87 overall. But when Truex's car slid up the track, both cars hit the wall.
That opened the door for Kahne, who had struggled all season. And as the crashes happened behind, Kahne overcame muscle cramps to hold on for his 18th career victory and first since Atlanta in August 2014.
The race was red-flagged with 10 laps to go after Kurt Busch, Erik Jones and Clint Bowyer collided coming out of the fourth turn.
On the ensuing restart, Kyle Larson hit the wall on the front straightaway to bring out another caution.
Things went awry once more when Jimmie Johnson, Keselowski and Kahne tried to go three-wide through the third turn on what was supposed to be the second-to-last lap. But Johnson's smoking car spun and slammed into the wall, forcing overtime.
"I wouldn't call it an absurdity, I just think it was a crazy race," Keselowski said. "There was some crazy strategy."
And after Trevor Bayne's car got sideways with two laps left in the first overtime, another red flag came out and another overtime began.
But the race still wasn't over.
With the sun setting and no lights at the track, Kahne barely made it to the overtime line as another multi-car pileup occurred behind him to bring out the last of the 14 cautions to seal the win.
The race had a little of everything - a 1-hour, 47-minute rain delay, 130-degree temperatures inside the cars and plenty of crashes.
None seemed like they would be bigger than the took out the two race leaders, Trues and Busch - the de facto Joe Gibbs Racing teammates.
For the first two-thirds of the race, it looked as if Busch would make history with his third straight victory at the track.
But when Truex's car started to spin on Lap 111, everything changed. Truex tapped Busch's No. 18 car, sending both into the wall and flames shooting out of the bottom of Truex's car.
Neither driver was seriously hurt, but neither appreciated with the result - especially since they are de facto teammates with Joe Gibbs Racing.
"That's the way it goes," Busch said. "Just chalk it up to another one we found a way to lose."
For Busch, it was a devastating blow.
After becoming the first Cup driver to capture back-to-back Brickyard poles since Ernie Irvan in 1997 and 1998 and extending his streak from last year to 181 consecutive laps led at Indy, he couldn't snap the 12-month winless streak.
The only racers with three straight wins at Indy are former Formula One star Michael Schumacher, who won the U.S. Grand Prix four consecutive times, and Marc Marquez, who won three straight MotoGP titles at Indy. Both won their titles on the track's road course.
Nobody has won three in a row on Indy's historic oval.
Busch won the first stage by 0.544 seconds and the second by 4.205 seconds - both over Truex.
"I just got loose and wrecked him. It was totally my fault," Truex said. "We worked well together and that's the hard part."