Andretti, 19, crossed the finish line 0.6557 seconds ahead of teammate Dario Franchitti to become the youngest winner in IndyCar Series history.
Through the first 25 laps of the race, pole sitter Scott Dixon led Andretti, the grandson of Mario Andretti, by 3.6503 seconds. By lap three, Dixon's margin was 1.4433 seconds, and it continued to build until he held a 10.8834-second margin on Andretti at the halfway mark.
He lost ground after his car stalled during a caution flag on lap 44.
"My guys are the best in the business," Andretti said after the race. "Their strategy was brilliant."
The fifth-place finish by Castroneves, combined with a ninth-place effort by Sam Hornish Jr., gives Castroneves a one-point lead in the IndyCar points race heading into the series finale Sept. 10 at the Chicagoland Speedway.
Celebrity Couples of 2014 [PHOTOS]