Josef Newgarden won his first Indy 500 championship on Sunday.
CNN  — 

Josef Newgarden won the 107th running of the Indianapolis 500 in a wild finish Sunday after three crashes in the last 16 laps. The American driver passed last year’s winner, Marcus Ericsson, in the final lap.

A trio of red flag crashes set up a dramatic finish during the race, which saw 52 lead changes among 14 drivers.

When the checkered flag finally waved after nearly three hours, it was Newgarden who claimed his first Indy 500 win – but getting there required a lot of drama.

In a terrifying scene with 16 laps to go, Felix Rosenqvist got loose and slid up into the wall. As Kyle Kirkwood tried to avoid the spinning Rosenqvist, he clipped the corner of Rosenqvist’s car.

Kirkwood’s car slammed into the wall, flipped and slid to a stop on its roof with sparks flying. The race was red-flagged, but neither driver was seriously injured.

In a scary twist, Kirkwood’s rear wheel broke free of its safety tether in the crash, cleared the catch fence and flew over the crowded grandstand, sending fans ducking for cover.

The tire came down in a parking lot and damaged at least one car, but no injuries were reported in the incident, according to NBC’s telecast.

Josef Newgarden  celebrates after winning the 107th running of the Indianapolis 500.

Eight laps later, Pato O’Ward, Simon Pagenaud and Agustin Canapino were involved in a heavy crash that brought another red flag.

With four laps remaining and Newgarden leading, there was another crash on the restart right at the start-finish line involving Benjamin Pedersen, Ed Carpenter and Graham Rahal, and the race was red-flagged again.

Ericsson had passed Newgarden on the restart just moments before the caution flag came out, meaning that Ericsson would be at the front of the line for the race’s final restart.

The green flag waved again with one lap to go, and Ericsson initially extended his lead over the chasing Newgarden. But Newgarden caught Ericsson and slingshot past him on the back straightaway to reclaim the lead.

It was smooth sailing from there to the finish line for Newgarden, who slipped through the fence to celebrate among the spectators before heading to victory lane for the traditional winner’s bottle of milk.

“I’ve always wanted to go into the crowd here in Indianapolis,” Newgarden said in a postrace interview on NBC’s telecast. “I’ve seen people go up on the fence, I wanted to go through the fence, I wanted to celebrate with the people.”

Hélio Castroneves, who won Indy a record-tying four times, would celebrate each win by climbing the fence, earning the nickname “Spiderman.”

Newgarden, who hails from Nashville, is the first Tennessee native to win the Indy 500.

The winner said he was emotional during the race’s final 10 laps.

“I knew we were in a position to fight for this win, and it wasn’t going to be easy,” said Newgarden, who started in 17th position. “(It) is not easy to win this race, it’s the most difficult race in the world to win.”

The 2023 race marked the third time a driver has won the Indy 500 from the 17th position.

This year’s tough race brought drama on pit row prior to Newgarden’s victory.

It began on the 95th lap as race pole sitter Alex Palou exited pit row.

Rinus VeeKay lost control of his car and crashed into Palou, pushing Palou’s car into the wall.

Palou’s pit crew had to drag the car back into his pit box to check it out.

Palou then had to make another pit stop to have his front wing replaced after the collision. He slipped from sixth to 28th place in the process.

There were also a pair of friendly fire incidents between teammates on pit row.

Christian Lundgaard swooped through his teammate’s adjoining pit box and nearly hit one of his teammate’s crew members, who was waiting to perform a tire change. Lundgaard hit the spare tire and knocked it onto the track.

Later, Colton Herta, who was running in fifth position at the time, pulled out of his pit box early and slammed into the side of teammate Romain Grosjean’s car, knocking himself out of contention to win.

Known as “The Greatest Spectacle in Racing,” the Indy 500 – named for the number of miles raced to complete the 200 laps – is among the best-attended single-day sporting events in the world.

Over 300,000 people were expected at the Indianapolis Motor Speedway to watch 33 IndyCar drivers zoom the 2.5-mile oval track.

CNN’s Issy Ronald contributed to this report.