Lewis Hamilton secured an unlikely pole position for the German Grand Prix after a double mechanical blow for Ferrari.
The Italian team had been fastest throughout practice at Hockenheim, but after an engine problem prevented Vettel from setting a lap time, a fuel-system issue then hit Leclerc's car.
Vettel will start his home race from the back of the grid, with team-mate Leclerc set to line up in 10th.
In the absence of both Ferrari drivers, championship leader Hamilton romped to the front to take pole. This, despite Mercedes having struggled for pace all weekend.
The British driver will be joined on the front row by Red Bull's Max Verstappen. Valtteri Bottas will line up from third.
Mercedes have played second fiddle to Ferrari here, with the red cars heading into qualifying having topped all three practice sessions.
But disaster struck from the outset. In the opening minutes, Vettel reported a lack of power on his very first outing to the track, and, after returning to his garage, his Ferrari mechanics were unable to rectify the issue.
It is the latest in a succession of blows to Vettel, who would have expected to be in contention for pole at his home race, and end a winless streak which stretches back to last August's Belgian Grand Prix.
In Vettel's absence, Leclerc was the overwhelming favourite to claim the third pole of his career.
But, ahead of Q3 - the shoot-out for pole - Ferrari mechanics were scurrying all over the back of the Monegasque's car. Under-fire team principal Mattia Binotto was seen pacing the garage.
With a handful of minutes remaining, Leclerc emerged from his cockpit, the issue terminal.
That paved the way for Hamilton to take pole, finishing a third of a second clear of Verstappen.
"I don't know how we did it today," said Hamilton. "I am not sure what happened to the Ferrari's. This is a second home grand prix for us so it is incredible to celebrate with this.
"Ferrari have been really fast, and they were on another level, but the time at the end would have been close to compete with Leclerc if he had set a lap."
On a poor weekend for Lando Norris, the British teenager was eliminated from Q1 for the first time in his career.
The 19-year-old, who has been second-best to Carlos Sainz in the sister McLaren throughout practice, finished only 16th. Sainz lines up in seventh.
British rookie George Russell out-qualified Robert Kubica for a 11th consecutive time. The young Englishman finished a tenth clear of his team-mate, and is set to start from 18th.