The 34-year-old Brazilian led the race's final 58 laps and gave team owner Roger Penske his 15th Indy 500 victory.
"This is the best month of May ever," Castroneves told reporters, referring to his acquittal in Miami on federal tax evasion charges last week.
Castroneves also won the high-profile race at the Indianapolis Motor Speedway in 2001 and '02.
He is the ninth driver to win the 500 three times.
Among the others are Al Unser Sr. and Emerson Fittipaldi.
Danica Patrick finished third, topping her previous best Indy 500 performance of fourth in 2005, with Townsend Bell and Will Power rounding out the top-five finishers.
The race, which was run on a dry track, featured several wrecks, including crashes by Tony Kanaan, Vitor Meira and Raphael Matos.
Meira was taken to Methodist Hospital and doctors said he suffered a broken back.
Justin Bieber crashes Drake Bell's album release party
Rosie O'Donnell unveils nearly 50-pound weight loss