Championship leader Fernando Alonso mastered the wet conditions at Hockenheim to grab pole position for tomorrow's German Grand Prix.

After taking top spot on the grid a fortnight ago in the rain at Silverstone, Alonso has now put his Ferrari on pole in back-to-back races, and for the 22nd time in his Formula One career.

The Spaniard was comfortably quicker by half a second than local hero Sebastian Vettel, born just 28 miles away in Heppenheim.

The reigning world champion was forced to settle for second, with Red Bull team-mate Mark Webber third, although the Australian has to serve a five-place grid penalty for a gearbox change.

Webber's penalty means Michael Schumacher jumps up to third in his Mercedes and is joined on the second row by another German in Force India's Nico Hulkenberg.

Williams' Pastor Maldonado will start fifth, and then come McLaren duo Jenson Button and Lewis Hamilton, the former out-qualifying the latter for the first time this season.

However, the duo both proved their tyres struggle in the wet as they found themselves three and a half seconds off the pace of Alonso on the full-wet Pirelli tyres.

With Webber starting eighth, behind him will be Force India's Paul di Resta and Lotus' Kimi Raikkonen.

In between the first two periods a loud rumble of thunder was the pre-cursor to the rain that turned Q2 and Q3 into wet sessions.

As the 15 minutes of Q2 started just as the rain was taking hold, there was a dash out of the pits from all the drivers on the intermediate set of tyres.

It was an attempt to make the most of the track conditions before the circuit became soaked, and for most it proved worthwhile.

Toro Rosso's Daniel Ricciardo missed out on a place in the top 10 by 0.060secs, qualifying 11th ahead of Sauber duo Sergio Perez and Kamui Kobayashi.

The big losers were behind them, with Ferrari's Felipe Massa 14th, followed by Romain Grosjean in his Lotus, Williams' Bruno Senna, and unhappily for Mercedes on home soil, Nico Rosberg.

For Grosjean and Rosberg, their situations are compounded by the fact they both face five-place grid penalties for gearbox changes which will see them start 20th and 22nd.

The end of the opening 20-minute session, that was run in the dry, proved to be a scramble for seven-times champion Schumacher.

Mercedes opted for a major gamble on sending him out for his final run on the medium tyre, for this race the slightly slower of the two on offer.

With others around him on the faster soft compound, Schumacher scraped into Q2 by just 0.055secs, pushing Toro Rosso's Jean- Eric Vergne into the bottom seven for the sixth time in 10 races.

Below the Frenchman Heikki Kovalainen out-qualified Vitaly Petrov for the eighth time, the Finn to start 17th and the Russian 18th.

Marussia's Charles Pic will line up 19th, followed by Grosjean, the second Marussia of Timo Glock, and then Rosberg.

At the back, Pedro de la Rosa maintained his 100% record over HRT team-mate Narain Karthikeyan, with the duo to line up 23rd and 24th.