Sebastian Vettel took pole position by nearly a second on a drying track in qualifying for the Malaysian Grand Prix.
With the circuit improving moment by moment in the final part of Q3, Vettel made great use of a fresh set of intermediates to lap in 1m49.674s for Red Bull.
The Ferraris will line up behind Vettel on the grid. Felipe Massa outqualified Fernando Alonso for a fourth straight race, but was still 0.9 seconds adrift of pole.
Lewis Hamilton held provisional pole for Mercedes going into the last minute, before being shuffled back to fourth by Vettel and the Ferraris.
Mark Webber was another man who had had a strong pole shot but ended up lower down, in his case fifth.
Q2 pacesetter Nico Rosberg completed the top six, with Kimi Raikkonen the top Lotus in seventh.
McLaren managed to get both cars into Q3, as Jenson Button and Sergio Perez took eighth and 10th. They were split by Adrian Sutil's Force India, which had been fastest in Q1.
The rain had started in Q2, catching out those who had not set an early banker lap.
The Ferraris just made it through in time, but Romain Grosjean's early time was pushed back to 11th, leaving the Lotus driver frustrated.
Paul di Resta spun helplessly to 15th, behind Nico Hulkenberg, Daniel Ricciardo and Esteban Gutierrez. Pastor Maldonado did not manage to get a lap in at all.
Williams had already lost Valtteri Bottas, unable to get out of Q1, along with Toro Rosso's Jean-Eric Vergne.
Both men were only a few tenths clear of the astonishing Jules Bianchi's Marussia. The French rookie beat the rest of the backmarkers by 0.9s ad was 1.2s quicker than team-mate Max Chilton.
Pos Driver Team Time Gap
1. Sebastian Vettel Red Bull-Renault 1m49.674s
2. Felipe Massa Ferrari 1m50.587s + 0.913s
3. Fernando Alonso Ferrari 1m50.727s + 1.053s
4. Lewis Hamilton Mercedes 1m51.699s + 2.025s
5. Mark Webber Red Bull-Renault 1m52.244s + 2.570s
6. Nico Rosberg Mercedes 1m52.519s + 2.845s
7. Kimi Raikkonen Lotus-Renault 1m52.970s + 3.296s
8. Jenson Button McLaren-Mercedes 1m53.175s + 3.501s
9. Adrian Sutil Force India-Mercedes 1m53.439s + 3.765s
10. Sergio Perez McLaren-Mercedes 1m54.136s + 4.462s
Q2 cut-off time: 1m37.342s Gap **
11. Romain Grosjean Lotus-Renault 1m37.636s + 1.446s
12. Nico Hulkenberg Sauber-Ferrari 1m38.125s + 1.935s
13. Daniel Ricciardo Toro Rosso-Ferrari 1m38.822s + 2.632s
14. Esteban Gutierrez Sauber-Ferrari 1m39.221s + 3.031s
15. Paul di Resta Force India-Mercedes 1m44.509s + 8.319s
16. Pastor Maldonado Williams-Renault no time
Q1 cut-off time: 1m37.931s Gap *
17. Jean-Eric Vergne Toro Rosso-Ferrari 1m38.157s + 1.348s
18. Valtteri Bottas Williams-Renault 1m38.207s + 1.398s
19. Jules Bianchi Marussia-Cosworth 1m38.434s + 1.625s
20. Charles Pic Caterham-Renault 1m39.314s + 2.505s
21. Max Chilton Marussia-Cosworth 1m39.672s + 2.863s
22. Giedo van der Garde Caterham-Renault 1m39.932s + 3.123s
107% time: 1m43.585s
* Gap to quickest in Q1
** Gap to quickest in Q2