INDIANAPOLIS -- At the end of 500 miles around Indianapolis Motor Speedway, it was a former Formula One driver who took the checkered flag.

He even drove for Andretti Autosport.

It just wasn't Fernando Alonso.

Takuma Sato became the first Japanese winner of the Indianapolis 500 on Sunday when he denied Helio Castroneves a record-tying fourth victory as the two traded the lead in the closing laps.

"I know Helio is always going to charge," Sato said. "But he's just such a gentleman and such a fair player."

The Andretti family has struggled for decades to win this race, but as a car owner, Michael Andretti certainly knows the way to Victory Lane.

Sato's victory gave Andretti a second consecutive win in "The Greatest Spectacle in Racing." An Andretti driver now has won the 500 three times in the past four years, and five times overall dating to 2005 with the late Dan Wheldon.

Last year, it was with rookie Alexander Rossi. This time it is with Sato, who joined the team just this season and had largely been overlooked at Indianapolis Motor Speedway. The Andretti camp expanded to six cars for the 500 to add Alonso, a two-time F1 champion who brought massive European interest to the race.

Six cars never seemed to spread the team too thin, and the main issue facing Andretti Autosport was the reliability of its Honda engines. Alonso put on a thrilling show and even led 27 laps -- third most in the race -- but he was sent to the paddock when his engine blew with 20 laps remaining.

"We didn't build the thing that was smoking down the front straight," said McLaren boss Zak Brown, who engineered Alonso's trip to Indianapolis. Part of the reason Alonso was able to skip F1's showcase Monaco Grand Prix earlier Sunday for Indy is because the McLaren team -- and its Hondas -- have grossly underperformed this season and Alonso is not a current title contender.

Alonso did have a spectacular race and simply fell victim to his engine late in the race. The crowd gave the Spaniard a standing ovation as he climbed from his car.

"I felt the noise, the engine friction, I backed off and I saw the smoke and, yeah, it's a shame," said Alonso, who ended up 24th. "It's a very nice surprise to come here with big names, big guys, the best in open-wheel racing, and be competitive."

He still drank from a carton of milk to close out his experience at Indy, and didn't rule out a potential return.

"The last two weeks, I came here basically to prove myself, to challenge myself," Alonso said. "I know that I can be as quick as anyone in an F1 car. I didn't know if I can be as quick as anyone in an Indy car."

The Honda teams had a clear horsepower advantage over Chevrolet, but things were dicey in Indy for more than a week and certainly on race day: Before Alonso's failure, 2014 winner Ryan Hunter-Reay lost his Honda and so did Charlie Kimball. Hunter-Reay led 28 laps and was a strong contender late.

"I'm really happy for Honda. They worked really hard to get us here," said Andretti. "I know how big this news is going to be tomorrow when they wake up in Japan. It's going to be huge. I'm really happy for them, that we were able to give them a win with our Japanese driver here."

Added Sato about the popularity of his victory in Japan: "This is going to be mega big. A lot of the Japanese fans are following the IndyCar Series and many, many flew over for the Indianapolis 500. We showed the great result today and I am very proud of it."

In a Chevrolet for Team Penske, Castroneves briefly took the lead but couldn't make it stick as Sato grabbed it back. Castroneves was disappointed to fall short of the four-time winners' club -- particularly since it was his third runner-up finish.

"Being second again sucks, being so close to getting my fourth," Castroneves said. "I'm really trying. I'm not giving up this dream and I know it's going to happen."

The margin of victory was 0.2011 seconds, and the win was redemption for Sato, who crashed while trying to beat Dario Franchitti on the final lap of the 2012 race.

A joyful Sato dumped a bottle of 2 percent milk over his head, received a kiss from the Indy 500 princess and raised his finger in the air. Michael Andretti ran down pit lane to reach Sato's crew, then rushed to hug his driver.

As for the difference between 2012, when Sato crashed in the first turn of the final lap racing Franchitti, Sato said his strategy this year was perfect.

"I was pointing in the right direction into [Turn] 1," said Sato, who was congratulated in Victory Lane by Franchitti.

It was only the second IndyCar victory for Sato, who won driving for A.J. Foyt in Long Beach in 2013 -- a span of 74 races.

Ed Jones finished a career-best third and was followed by Max Chilton and Tony Kanaan, the highest finishers for Chip Ganassi Racing. Two-time winner Juan Pablo Montoya was sixth.

Honda drivers took six of the top 10 finishing positions.

Pole sitter Scott Dixon, already having a rough week because he was robbed at gunpoint at Taco Bell hours after turning the fastest qualifying effort in 21 years, was knocked out of the race in a terrifying crash in which his car sailed through the air and landed cockpit-first atop the inside safety fence. Dixon's car was split in two amid sparks and flames.

The tub of the car remained intact and the 2008 champion was able to climb out on his own to a roar from the crowd. He walked to a waiting ambulance while the race was placed under red flag and crews began to clean up debris scattered over hundreds of feet in the accident caused when Dixon's car collided with that of Jay Howard.

"Just a little beaten up there. It was definitely a rough ride," Dixon said. "We had a great shot. We had gotten a little loose, but they had dialed it in."

Dixon tweeted his congratulations to Sato after the race.