Nico Rosberg will start the German Grand Prix from pole position after bouncing back from an electronic error to set the pace in qualifying.
On home soil, Rosberg was forced to abandon his first attempt in Q3 after an issue but recovered to put in a 1m14.363 in the final minutes of the session.
Lewis Hamilton was quickest in the opening two segments of qualifying but had to settle for second after a lock-up on his final lap.
Daniel Ricciardo was third, ahead of his Red Bull team-mate Max Verstappen and the Ferrari duo of Kimi Raikkonen and Sebastian Vettel.
Nico Hulkenberg made it through to Q3 and was seventh in front of his home crowd, with Valtteri Bottas next up for Williams. Sergio Perez and Felipe Massa completed the runners in Q3.
Esteban Gutierrez and Jenson Button both spent brief moments in the top 10 before falling into the Q2 drop-zone, qualifying 11th and 12th.
Carlos Sainz Jr. and Fernando Alonso were next up, with Esteban Gutierrez – who has a gearbox change penalty – and Jolyon Palmer also failing to make it through to Q3.
In the first segment of qualifying, Kevin Magnussen was the first to be eliminated. He fell into the drop-zone after some late improvements, with Pascal Wehrlein just 0.001 seconds behind the Renault.
Daniil Kvyat was a disappointing 19th for Toro Rosso, ahead of Rio Haryanto in the second Manor car, Felipe Nasr and Marcus Ericsson – who made a mistake on his final lap.