Fernando Alonso will start the German Grand Prix from pole position after the world championship leader shone in wet conditions at Hockenheim.
The world championship leader set a time of 1min 40.621 seconds to edge out Sebastian Vettel's Red Bull Racing car.
Vettel's teammate Mark Webber was third quickest, but will start eighth due to a five-place grid penalty for a gearbox change.
That promotes Michael Schumacher to third place in his Mercedes, with Nico Hulkenberg's Force India completing an all German second row.
Pastor Maldonado will start fifth in his Williams, ahead of the McLaren-Mercedes pair of Jenson Button and Lewis Hamilton.