INDIANAPOLIS (AP) — Tony Kanaan has finally won the Indianapolis 500.

Kanaan drove past Ryan Hunter-Reay on a restart Sunday with three laps to go, then coasted across the finish line under yellow when defending race winner Dario Franchitti crashed far back in the field.

It was a hugely popular victory at the speedway, where Kanaan had endured so much heartache. The Brazilian had led 221 laps coming into the race, more than any other non-winner besides Michael Andretti and Rex Mays, yet had never taken the checkered flag. He finished second in 2004 and twice finished third.

Now, his face will go on the Borg-Warner Trophy. Kanaan is an Indy 500 champion, coming through on a cool day of thrilling competition that smashed the record for most lead changes and most leaders. The crowd of some 200,000 roared when it realized that Kanaan had finally broken his Brickyard curse.

On the final lap, Kanaan lifted the visor on his helmet and appeared to dab at his eyes. When he pulled into Victory Lane, he planted a kiss on his wife, Lauren, and dunked an entire bottle of milk over his head.

The leaders came to the finish line all bunched up around Kanaan, saluting the longtime IndyCar stalwart who had longed to add the one missing piece to his resume. That was about as slow as anyone had driven all day. The average speed was 187.433 mph, another Indy record.

Rookie Carlos Munoz finished second with a brilliant IndyCar debut, followed by series champion Ryan Hunter-Reay, Marco Andretti and Justin Wilson. Helio Castroneves, trying to become the fourth driver to win four Indy 500s, ran up front much of the day but settled for sixth.

Kanaan and Andretti charged to the front during a wild first half of the race.

Kanaan quickly moved through the field from the outside of the fourth row while Andretti started on the outside of the front row and spent the first 29 laps playing leapfrog with Kanaan as the standard-bearer for his family bids to end the "Andretti Curse." The family hasn't captured the fabled Memorial Day weekend race since his grandfather, Mario, won in 1969. Michael Andretti has been to Victory Lane twice as a team owner with the late Dan Wheldon in 2005 and Dario Franchitti in 2007, but never won the race as a driver.

Marco Andretti was second in 2006 in the second-closest finish in the race's history.

Franchitti, the defending race winner, and Castroneves began the day in pursuit of their fourth victory. Only A.J. Foyt, Rick Mears and Al Unser have won the Indy 500 four times.

As the race reached the halfway mark, Team Penske roared to the front.

Will Power spent a stint in the lead before teammate A.J. Allmendinger, making his Indy 500 debut, picked his way through the field before falling back because of a problem with his safety belts. Allmendinger is a former open-wheel star who spent time in NASCAR before losing his ride after a failed drug test. He was given a second chance in the Indianapolis 500 by Roger Penske — the same Sprint Cup team owner who had fired him.

Allmendinger was cheered on by Sprint Cup champ Brad Keselowski, who was on hand to support his boss's teams before catching a quick flight to Charlotte for Sunday night's Coca-Cola 600.

"I want to experience the IndyCar life here and see what it's all about and how this race plays out," Keselowski said. "I'm really excited to be here. This is my first Indy 500. I'm here soaking in one of the biggest races of the year with one of the best guys here, Roger Penske."

The race began with a chill in the air — the temperature was 62 degrees, not much warmer than the coldest race in history (58, 1992). Thousands of fans who piled into the historic track were bundled up against a stiff breeze that swirled down the front straightaway, and many arrived late, some blaming new security measures put in place after the Boston Marathon bombings.