Lewis Hamilton took pole position for the Malaysian Grand Prix, while Mercedes' run of nine straight front-row lockouts in Formula One came to an end as Ferrari's Sebastian Vettel qualified second.

A drenching thunderstorm delayed the final part of qualifying but even a wet track could not prevent Hamilton topping the grid with a time of one minute, 49.834 seconds at Sepang International Circuit.

Vettel was second, only seven hundredths of a second off Hamilton's time as Ferrari showed it could challenge Mercedes in Sunday's race.

Nico Rosberg was third for Mercedes while Red Bull driver Daniel Ricciardo qualified fourth ahead of his teammate Daniil Kvyat in fifth.

Toro Rosso's 17-year-old rookie Max Verstappen was an impressive sixth, while Williams put in a disappointing performance on the intermediate tires used in Q3. Felipe Massa qualified seventh and Valtteri Bottas in ninth.

Ferrari's Kimi Raikkonen was the main victim of the rapid arrival of the rain early in Q2.

Knowing the rain was coming, all drivers set out at the very start of the session, but Raikkonen ran into traffic on his flying lap and all drivers then immediately aborted any effort to improve their times as heavy showers swept the circuit.

Raikkonen qualified 11th, having been in the top three of all practice sessions

Grid (top-10):

1. Lewis Hamilton (Britain) Mercedes
2. Sebastian Vettel (Germany) Ferrari
3. Nico Rosberg (Germany) Mercedes
4. Daniel Ricciardo (Australia) RedBull - Renault
5. Daniil Kvyat (Russia) RedBull - Renault
6. Max Verstappen (Netherlands) Toro Rosso - Renault
7. Felipe Massa (Brazil) Williams-Mercedes
8. Romain Grosjean (France) Lotus - Mercedes
9. Valtteri Bottas (Finland) Williams-Mercedes
10. Marcus Ericsson (Sweden) Sauber - Ferrari

Source: AP