Hamilton appeared set to claim his eighth win of a dominant season before drama struck on lap 29 of 64 in a race which featured four safety car periods.
The British star, who had just stopped for dry rubber, ran off the road at a final corner which had claimed Ferrari's Charles Leclerc one lap earlier.
Hamilton had to stop for a new front wing and was stationary for more than 50 seconds as his Mercedes crew dashed around for spare parts.
He finished 11th, having also been hit with a five-second penalty for entering the pits on the wrong side of the bollard, and spun in the final stages too on a day to forget for the world champion.
Verstappen, who stopped five times in the most topsy-turvy of races, took the chequered flag to claim his second win of the campaign.
On a miserable day for Mercedes at their home race, Valtteri Bottas crashed out at the first corner with eight laps remaining, while in the hunt for the podium.
Bottas' spin brought a furious reaction from Toto Wolff, the Mercedes team principal banging both his fists on the table.
Hamilton held a commanding 35-second lead when he stopped to change on to the dry tyres.
But the last corner of the Hockenheim circuit was still damp, and after it caught Leclerc out, the young Monegasque crashing from second, Hamilton hit the barriers too.
While Leclerc retired, Hamilton was able to limp back to the pit lane, falling back to fifth following a comical pit stop, before gaining two places to third.
But then Nico Hulkenberg also crashed out at the final corner, resulting in a third safety car period.
Hamilton pitted a lap late leaving him way down the order. Running in 12th, Hamilton said: "How has it gone this bad?"
"Copy that, Lewis," came the reply from his engineer, Pete Bonnington. "That is something we are going to have to review."
There were then huge cheers from the grandstands as Hamilton fell off the road again, spinning at the opening bend.
He pitted for new tyres, dropping to last place. He would finish outside of the points, 11th of the 13 classified runners.
There were no such concerns for Verstappen, who kept his cool to win by more than seven seconds.
Vettel, who had started from the back of the grid after his engine broke in qualifying, made several moves in the final laps to seal the runner-up spot.
"It was about trying not to make mistakes," said Verstappen. "It feels amazing to win.
"You learn over the years. I was very happy with the whole performance."
Stroll took fourth ahead of McLaren's Carlos Sainz with the London-born Alexander Albon a career-best sixth. Lando Norris failed to finish following a gearbox issue.
Vettel added: "It was a long race. At some stage it felt never-ending. It was very tough with the conditions. I am just happy."
1 Max Verstappen (Ned) Red Bull 1hr 44mins 31.275secs
2 Sebastian Vettel (Ger) Ferrari 1:44:38.608
3 Daniil Kvyat (Rus) Scuderia Toro Rosso 1:44:39.580
4 Lance Stroll (Can) Racing Point 1:44:40.241
5 Carlos Sainz (Spa) McLaren 1:44:40.858
6 Alexander Albon (Tha) Scuderia Toro Rosso 1:44:41.327
7 Kimi Raikkonen (Fin) Alfa Romeo Racing 1:44:43.489
8 Antonio Giovinazzi (Ita) Alfa Romeo Racing 1:44:45.124
9 Romain Grosjean (Fra) Haas F1 1:44:48.113
10 Kevin Magnussen (Den) Haas F1 1:44:50.040
11 Lewis Hamilton (Gbr) Mercedes GP 1:44:50.942
12 Robert Kubica (Pol) Williams 1:44:56.262
13 George Russell (Gbr) Williams 1:44:57.679
14 Pierre Gasly (Fra) Red Bull at 3 laps
15 Valtteri Bottas (Fin) Mercedes GP 56 laps completed
16 Nico Hulkenberg (Ger) Renault 39 laps completed
17 Charles Leclerc (Mon) Ferrari 27 laps completed
18 Lando Norris (Gbr) McLaren 25 laps completed
19 Daniel Ricciardo (Aus) Renault 13 laps completed
20 Sergio Perez (Mex) Racing Point 1 lap completed
Register for free to continue reading
Registration is a free and easy way to support our truly independent journalism
By registering, you will also enjoy limited access to Premium articles, exclusive newsletters, commenting, and virtual events with our leading journalists
Already have an account? sign in
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies