Simon Pagenaud will start Sunday's Iowa Corn 300 IndyCar race from pole position after edging out Josef Newgarden in qualifying on Saturday afternoon.
Pagenaud arrived at Iowa Speedway leading the IndyCar drivers' championship but without a win since the Grand Prix of Indianapolis in the middle of May.
Tony Kanaan set the pace in practice for Chip Ganassi Racing before laying down a two-lap average of 184.430 mph early on in qualifying.
With track conditions changing dramatically ahead of qualifying, drivers struggled to replicate their pace from practice, but Penske's Castroneves was able to dig deep and edge out Kanaan by 0.003 mph over his two laps.
Pagenaud followed immediately after Castroneves in the qualifying order, and duly went a further 0.4 mph quicker over his two laps to leave the rest of the field with a sizeable gap to make up.
Ed Carpenter Racing's Newgarden ran Pagenaud closer than anyone, finishing less than 0.2 mph behind, but it was not enough to deny the Frenchman his fifth pole of the 2016 IndyCar season.
Castroneves followed Newgarden in P3 ahead of Max Chilton, who produced a stunning two-lap effort at the site of his first Indy Lights victory 12 months ago. Chip Ganassi Racing teammates Charlie Kimball and Tony Kanaan followed in P5 and P6 respectively.
Ed Carpenter qualified seventh upon his return to the #20 car, finishing ahead of Will Power and Mikhail Aleshin. Defending IndyCar champion Scott Dixon rounded out the top 10 as the slowest Chip Ganassi Racing car.
Qualifying saw a great disparity between the Chevrolet and Honda-powered cars; Schmidt Peterson Motorsports' Aleshin was the only Honda driver to finish ahead of a Chevrolet.
Andretti Autosport's hopes of continuing its stunning Iowa record and extending its winning streak into a seventh year took a hit as it could only finish as high as P15 thanks to a late run from Carlos Munoz. Indy 500 winner Alexander Rossi qualified 17th ahead of teammates Marco Andretti and Ryan Hunter-Reay.