Former world champion Lewis Hamilton avoided crashes and shrugged off a torrential downpour to claim a British record-equalling 33rd pole position at a thrilling Malaysian Grand Prix qualifier on Saturday.
In a session which had nearly an hour's rain delay, and was twice suspended for crashes on the slippery Sepang circuit, the Mercedes driver came out on top ahead of surging world title-holder Sebastian Vettel.
Hamilton's team-mate Nico Rosberg, who won the season-opener in Australia, will start Sunday's race from third with Ferrari's Fernando Alonso fourth after surviving a collision with Daniil Kvyat.
Vettel's new Red Bull partner Daniel Ricciardo will start from fifth ahead of Ferrari's Kimi Raikkonen and Nico Hulkenberg, who impressively placed his Force India sixth.
Williams driver Valtteri Bottas was given a three-place grid penalty for obstructing Ricciardo in Q2, and will start from 18th. But Alonso and Kvyat both escaped sanction after an inquiry into their crash.
Hamilton was thankful to grab his second straight pole this year, and the 33rd of his career -- equalling Jim Clark's British record -- with a lap time of 1min 59.431sec, 0.055 quicker than Vettel.
"Today was just incredible how much it rained before and then during the session, it was very, very tricky for everyone," the 2008 world champion said. "Particularly at the end, it was almost impossible to see. I tried to do my last lap but I couldn't see a thing."
However, the more significant result could be Vettel's second place as the four-time defending world champion, who like Hamilton retired in Australia, showed signs of life after severe early-season problems.
"I'm very happy because we had a bad winter but the team's fired up, the guys are pushing still flat-out," Vettel said, adding: "I think we always have a chance to beat everybody, that's why we're here."
- Difficult conditions -
When the tropical deluge eased and qualifying finally got underway, there was an early problem for Vettel as he was quickly ordered back to the pits for a problem with his energy store.
And Q1 came to a premature end when Marcus Ericsson lost control of his Caterham, slid through a hoarding and back on to the track, where he was only narrowly missed by Sauber's Esteban Gutierrez.
Q2 lasted just a couple of minutes before the red flags halted qualifying again when Ferrari's Alonso collided with Kvyat's Toro Rosso at a corner, and he limped back to the pits with front suspension damage.
But after frantic work in the Ferrari garage, the Spaniard rejoined to make sure of his place in the top-10 shoot-out, with Hamilton setting the pace.
Magnussen slid off late in Q2 but he avoided the fate of Williams' Felipe Massa and Valtterri Bottas, and Lotus's Romain Grosjean, who were among the drivers who missed out on Q3.
In the final shoot-out, Raikkonen complained "we have to change tyres" after his table-topping opening time was quickly usurped by both Mercedes, Alonso and both Red Bulls.
Hamilton was on top but he warned "I can't see anything out of my mirrors" as conditions worsened and lap times slowed with huge plumes of spray over the track.
The teams will now be braced for a repeat of 2009, when rain cut short the Malaysian race, and 2012, when a downpour forced a lengthy suspension.
Several drivers carried helmet stickers reading "Pray for MH370" and the Malay-language version "Doa Untuk MH370" in tribute to the 239 presumed killed in a missing Malaysia Airlines passenger jet.