Sebastian Vettel will start his home German Grand Prix at the back of the grid after Ferrari suffered turbo problems in qualifying.
Formula One leader Lewis Hamilton put Mercedes on pole position for their 200th race at the German Grand Prix on Saturday after Ferrari's hopes of seizing the top slot were dashed by engine problems.
Red Bull's Max Verstappen will share the front row alongside the five-times world champion, with Hamilton's team mate Valtteri Bottas third.
Ferrari's Sebastian Vettel lines up last after a turbo-related problem meant he failed to set a time while team mate Charles Leclerc was sidelined in the final phase with a fuel system issue and starts 10th.
The pole was a record-extending 87th of Hamilton's career.
"Lewis, this is Toto. You never stop to amaze us," team principal Toto Wolff, whose employers are also celebrating their 125th year in motorsport, told the Briton over the team radio.
Hamilton, winner of seven of the 10 races so far, leads Bottas by 39 points in the overall standings.
"I'm not really sure how we did it today, and I'm not really sure what happened to the Ferraris," said Hamilton.
"It's such an important race for us, our second home Grand Prix, and 125 years of motor racing, so it's incredible to celebrate in this way."
Leclerc had been fastest in practice on Friday and Saturday and had looked a good bet for pole, with Mercedes struggling in the opening phase, before the gremlins struck.
"It's a difficult day for the team, I hope it will be a very positive day tomorrow," said the Monegasque.
"I felt great in the car and the car felt great today and all weekend so it's a shame it ends up like this."
Red Bull's Pierre Gasly qualified fourth with Kimi Raikkonen fifth for Alfa Romeo and Romain Grosjean lining up sixth for Haas.
McLaren's Carlos Sainz qualified seventh and Sergio Perez eighth for Racing Point.
Ferrari woes mount
Sebastian Vettel will start his home German Grand Prix at the back of the grid after Ferrari suffered turbo problems in qualifying on Saturday.
Monegasque team mate Charles Leclerc added to the Italian team's woes when he was sidelined in the final shootout for pole position, stepping out of his car without setting a timed lap.
Ferrari said Vettel, a four-times Formula One world champion, had suffered a problem with the air flow to the car's turbo.
Vettel, who started last year's race on pole position but crashed out while leading, has not won since the Belgian Grand Prix last August.
The German reported a loss of power on the radio shortly after he left the pits for his first run during the opening phase of qualifying.
"I don't know what happened," Vettel told Sky Sports television.
"Something broke with the turbo and it was game over from there. Obviously I'm very bitter, I think the car is great and we've lost out on a big chance but hopefully we'll have a big one coming again tomorrow.
"I'm looking forward to the race, but obviously it would have been nicer to start at the very front than the very back but we'll see what happens."
Vettel is fourth overall in the championship, 100 points adrift of Mercedes' rival Lewis Hamilton after 10 of the 21 races.
"He has enough experience to know there is still a chance tomorrow," said compatriot Nico Rosberg, the retired 2016 world champion for Mercedes. "He can make a good comeback if it does rain, chances are high.
"I think he'll settle down this evening and by tomorrow morning he'll be back on it and firing on all pistons."