The 37-year-old driver barely reached the overtime line before the last caution flag came out in a crash-marred Brickyard 400, allowing Kahne to complete a six-hour marathon and snap a long winless streak.

He crossed the yard of bricks under caution with daylight fading and his muscles cramping, just ahead of Brad Keselowski and Ryan Newman.

"I had a great car out front. I had a pretty good car all day long. I was really happy," Kahne said. "Unbelievable to win in Indianapolis. Unbelievable to win a Cup race - it's been a while. I know it's great for my team."

But even before kissing the bricks and posing for photos, Kahne's long-awaited victory celebration was put on hold as he dropped to the ground and his crew members tried to rub out the cramps he fought through late in the race.

Afterward, Kahne went to the speedway's infield medical center where he received intravenous fluids. Other drivers said temperatures inside the cockpits topped 130 degrees.

The wacky race had a little of everything - 14 cautions and 55 caution laps, both race records, three red flags and a 1-hour, 47-minute rain delay. Nineteen cars did not finish. It lasted so long, drivers were racing against the impending darkness as much as they were themselves.

For Kahne, his 18th career win might have been the sweetest of all.

He had only three top-10 finishes in the first 19 races. His future with Hendrick Motorsports was in question, and after going almost three full years and more than 100 races without a win, he was finally back in victory lane.

"It puts him in the chase," team owner Rick Hendrick said after his 10th Brickyard victory. "It puts him in the playoff. We're excited about that."

Kahne's last win came in Atlanta in August 2014.

By any measure, it was a wacky day.

The two fastest cars on Indy's 2.5-mile oval - Kyle Busch and Martin Truex Jr. - went out in a crash with 49 laps to go. Truex's car slid up the track going through the first turn and the Toyota teammates both wound in the wall. Busch led the first 71 laps, 87 of the first 110 and swept the first two stages ahead of Truex.

"That's the way it goes," Busch said. "Just chalk it up to another one we found a way to lose."

The finish was even wilder.

Over the last 16 laps, there were five crashes and two red flags.

The craziness began when Kurt Busch, Erik Jones and Clint Bowyer got together 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 again went awry when Jimmie Johnson, Keselowski and Kahne went three-wide through the third turn on what was supposed to be the second-to-last lap. But Johnson's smoking car started spinning and hit the wall to force overtime.

"I wouldn't call it an absurdity, I just think it was a crazy race," Keselowski said. "There was some crazy strategy."

Trevor Bayne got into the mix with two laps in the first overtime when his car was bumped from behind, sending it sideways through the field. Six cars got collected in the crash, bringing out yet another red flag and adding more laps to the race.

Kahne finally ended it by reaching the line just ahead of Keselowski as another multi-car crash occurred behind him.

"As much as I didn't need him winning I'm happy for (at)kaseykahne," Clint Bowyer wrote on Twitter. "People have written him off lately. HUGE win under extreme pressure."

YOUNG GUNS

The next generation of Cup drivers struggled Sunday.

Larson, who was a big mover early in the race, finished 28th. Chase Elliott was knocked out after 43 laps because of an engine failure and wound up 39th.

Ryan Blaney also was knocked out in one of the late crashes and finished 23rd.

EARNHARDT & DANICA RESULTS

Dale Earnhardt Jr. also had a tough day in his final Brickyard start. The 42-year-old driver damaged his radiator when he hit the back of Bayne's car on Lap 77 and wound up pulling off the track and stopping underneath the Gasoline Alley sign. When he climbed out, Earnhardt received a loud roar.

"There was just a bunch of cars slowing down, starting a chain reaction. We got into the back of (Bayne)," he said. "It just knocked the radiator out of us. We had a great car. We had a top-10 car. I thought we could finish there."

Former IndyCar favorite Danica Patrick received a penalty for a pit violation early in the race and finished 11th.

UP NEXT

Next Sunday, the series moves to Pocono, Pennsylvania, where Chris Buescher is the defending champion.