Red Bull's Max Verstappen took his second win of the year in a chaotic and incident-strewn German Grand Prix held in intermittent rain.
The Dutchman led a topsy-turvy result in which Ferrari's Sebastian Vettel took second from the back of the grid and Toro Rosso's Daniil Kvyat was third.
Lewis Hamilton had a day to forget, finishing 11th after two mistakes.
But the Briton did not lose any ground to team-mate Valtteri Bottas in the championship after the Finn crashed.
It was a dismal way for Mercedes to end a weekend when the team celebrated 125 years in motorsport and their 200th Formula 1 race.
But the Mercedes drivers were not the only ones to fall foul of the treacherous conditions in a race that featured a remarkable six safety cars - two of them virtual - and the winner made five pit stops to change back and forth between wet and dry tyres.
Ferrari's Charles Leclerc crashed when looking in strong shape for at least second place. Renault's Nico Hulkenberg went off at the same place, the treacherous penultimate corner, which was also where Hamilton made one of his errors.
Verstappen supreme as Mercedes slip up
Through the chaos, Verstappen drove a flawless race, tracking the Mercedes in third place through the first half of the grand prix and then moving to the front as the world champions' race fell apart.
Red Bull made all the strategy calls correctly and Verstappen judged the conditions perfectly to take a well-deserved victory which made him look the class of the field - although even he had a big spin, one corner before the bend that took out Leclerc, Hulkenberg and Hamilton.
Mercedes' race began to fall apart when Hamilton ran wide at the penultimate corner, slid across the slippery run-off which is part of a drag strip and hit the wall.
Unlike Leclerc, who had gone off into the gravel the lap before when looking poised to take second place and was unable to get out of it, Hamilton did rejoin the track but with a damaged front wing.
He pulled straight into the pits, breaking the rules by going the wrong side of a bollard, and then spent 50 seconds stationary as the Mercedes mechanics - who had been expecting Bottas to come in - mirrored an episode of Wacky Races as they ran about trying to replace his front wing and find the right set of tyres, bumping into one another along the way.
To make matters worse, the infringement with the bollard earned him a five-second penalty.
He rejoined the track in fifth place and after the restart soon passed Alexander Albon's well-driven Toro Rosso for fourth and then Hulkenberg's Renault for third.
But when Hulkenberg followed Leclerc and Hamilton into the wall after running wide at the second-last corner, there was another safety car, which went a long way to defining the finishing positions.
Verstappen pitted for fresh intermediate tyres but Mercedes did not, a decision Hamilton immediately questioned, the team saying they did not want to have to serve the penalty then, even though it seemed the obvious thing to do.
But shortly after the re-start on lap 46, with 18 laps to go, the track was drying and drivers pitted for dry-weather tyres. Mercedes left it a lap later for Hamilton than Verstappen and Bottas and he rejoined in 12th place.
He asked the team: "How did it go this bad?"
"Copy that, Lewis," he was told by his race engineer Peter Bonnington, who said they would look into it later.
Trying to make up lost ground, Hamilton then had a massive spin at Turn One with 11 laps to go. He needed to stop again for fresh tyres, which cost him any chance he might have had of points.
It looked like he had gifted Bottas a great opportunity to make up some serious ground in the championship but then the Finn made his own mistake at the first corner four laps after Hamilton.
It was an error Bottas will probably rue for a very long time.
Redemption for Vettel and Kvyat
At the opposite end of the scale, it was a remarkable day for Kvyat and Vettel, and redemption for both, in a way.
Vettel returned to the place he had last year crashed out of the lead and after a largely quiet race, much of which he spent in the lower reaches of the top 10, he came alive in the closing laps.
Fourth at the time of the final safety car following Bottas' crash, Vettel picked his way past McLaren's Carlos Sainz, Racing Point's Lance Stroll and Kvyat to take a superb second place.
Stroll and Kvyat had found themselves up in second and third places after their teams decided to pit them towards the end of the safety car period for Hulkenberg's crash.
Kvyat, who has returned to F1 this season after being sacked by Red Bull at the end of 2017, passed Stroll to take second place but could not hold off Vettel's late charge.
"It was like a horror movie mixed with a black comedy," the Russian said - a quote that seemed to sum up the events of the day.
Stroll fell behind Vettel but still managed an excellent fourth place for the team now owned by his father, while Sainz took fifth and Albon his career-best finish of sixth halfway through his debut season.
Vettel's performance was a much-needed boost for Ferrari after a nightmare weekend until that point.
Both cars went out of qualifying at various times with engine problems, leaving Leclerc 10th on the grid and Vettel last.
Leclerc had made good progress in the opening laps and Ferrari's strategists had put him in a great position with perfect strategy calls in the first half of the race.
But he ran wide at the penultimate corner on lap 28, just after gambling on dry-weather tyres on a drying but not totally dry track. He got on to the slippery run-off, which seemed to be covered with a kind of film of soap, and slid into the gravel, his wheels spinning as he vainly fought to extricate himself.
"It was very slippery but the only thing I can say is I think it is unacceptable to have this kind of Tarmac. It is like a dragster track and once you go on it is very dangerous," Leclerc said.
"I take full responsibility for the mistake but I believe this kind of Tarmac shouldn't be on a Formula 1 track."