Vettel topped qualifying with a devastating final lap in his Ferrari to pip Valtteri Bottas in the second Mercedes.
A distraught Hamilton limped out in the first qualifying session when his car broke down with a hydraulics failure.
Vettel rubbed salt in the British defending wporld champion's wounds by outpacing Bottas by two-tenths of a second.
In front of a huge crowd of flag-waving Germans at the track near his Heppenheim birthplace, Vettel delivered a lap record in one minute and 11.212 seconds to top the Finn’s 1:11.416.
"Thanks to those fans," said Vettel. "It was amazing to see so many Ferrari and Germany flags.
"It just kept getting better and I knew for the last lap I had a little bit more – I am full of adrenaline, but feel so happy.”
It is his second pole for a German Grand Prix and the 55th of his career.
Vettel’s qualifying success makes him favourite to land his first Formula One victory at Hockenheim and only his second Grand Prix win in Germany as he seeks to extend his eight-point advantage over Hamilton.
Kimi Raikkonen was third in the second Ferrari ahead of Max Verstappen of Red Bull and the two Ferrari-powered Haas cars of Kevin Magnussen and Romain Grosjean.
Another home hope Nico Hulkenberg was seventh ahead of his Renault team-mate Carlos Sainz, rising Monegasque star Charles Leclerc of Sauber and Sergio Perez of Force India.
Hamilton, who had attempted to push his car to stay in contention, said: "It was definitely a tough one, but these things happen and all you can do is try and gather your thoughts and live to fight another day.
"I’ll give everything tomorrow to see how high I can get up, but its not going to be like Silverstone."
Hamilton is expected to start 14th on the grid.