(CNN) -- Ryan Hunter-Reay won the Indy 500 Sunday, holding off three-time champion Helio Castroneves at the finish line.
The margin of victory was .06 seconds, the second-closest finish in the race's history.
"I knew we had a good race car. We ran to the front; I was just biding my time," said Hunter-Reay, who started 19th. "We did everything right today. I'm thrilled. This is as big as a championship for me."
Marco Andretti, the third generation of the famous motor racing family to race at the Brickyard, finished third and is still looking for his first victory at the historic event in Indianapolis.
Castroneves was trying for a record-tying fourth win in the IndyCar race. A.J. Foyt, Rick Mears and Al Unser Sr. are the other men to win four Indy 500s.
"Second is good," Castroneves said of his high finish in the Indianapolis 500. "But second sucks."
The race was a back-and-forth battle between Hunter-Reay and Castroneves after a restart from a red flag that halted the race with 10 laps to go.
After the race went back to green with six laps remaining, they traded places several times with Hunter-Reay reclaiming the top spot just before the final lap began.
It was Hunter-Reay's first win in the 200-lap race. Last year, he was third, his best finish in the event until Sunday.
Carlos Munoz was fourth. Juan Pablo Montoya was fifth. Kurt Busch, who was also driving in NASCAR's Coca-Cola 600 on Sunday evening, was sixth.