Lewis Hamilton fought his way up from 20th on the grid to finish third as his team-mate and title rival Nico Rosberg won the German Grand Prix.
The Briton staged a superb recovery drive despite damaging his front wing in a collision at around half-distance when passing Jenson Button's McLaren.
He caught Williams' Valtteri Bottas in the final laps but could not pass.
Red Bull's Sebastian Vettel beat Ferrari's Fernando Alonso for fourth with team-mate Daniel Ricciardo sixth.
Rosberg's victory on home soil leaves him 14 points clear of fellow Mercedes driver Hamilton at the head of the championship with nine races remaining.
"I had great fun," said Hamilton. "I did as good as I could today. It was very hard to get through the field safely.
"I had a little collision with Jenson. I really thought he was opening the door for me; he has been very good like that in recent races. So my bad on judgement there."
The race in Hockenheim began with high drama as Williams' Felipe Massa and McLaren's Kevin Magnussen collided at the first corner, tipping the Brazilian's car upside down.
The Williams skated into the run-off area, triggering the safety car while officials confirmed Massa was unhurt.
He had advanced to 10th before the cars in front, which had started on the 'super-soft' tyre rather than the Briton's 'soft' tyre, began their pit stops around lap 12. Hamilton, who ran until lap 26 before making his first stop, took advantage to advance to second behind Rosberg - the German making his first stop on lap 16.
With Hamilton's team assuring him he remained on course to finish second after his stop, that target suddenly became more difficult when he dived late down the inside of Button for sixth place on lap 30.
Hamilton's former team-mate saw him coming and left room but turned in when he thought the Mercedes was too far back. The two cars collided mid-corner, taking off most of the Mercedes' front-wing endplate. Hamilton waved his apologies when he passed the McLaren on the following lap.
Having initially planned to keep Hamilton on a two-stop strategy, Mercedes switched to an extra stop once he reported that his tyres were wearing too quickly, opting for two short sprints at the end of the race on the fast-but-fragile super-soft.
His second stop came on lap 32 and his final one seven laps later - triggered by Adrian Sutil spinning his Sauber out of the last corner and being left stranded in the middle of the track for several laps.
Hamilton emerged fourth behind Rosberg, Bottas and Alonso, passed the Spaniard easily, and was 15 seconds behind Bottas with as many laps to go.
With five laps remaining he was on the Finn's tail and seemed sure to regain second, but with his super-soft tyres past their best, Hamilton could not get close enough out of Turn Two to pass into the Turn Five hairpin.
"[Rosberg and Hamilton] were too quick today but I'm really happy we managed to keep at least one of them behind us," said Bottas after a third successive podium.
"It was not easy - we needed all the information from the engineers."
Alonso battled with Vettel for much of the race before a stop that left him down in seventh. He quickly re-passed Button, but Ricciardo proved sterner opposition and the two staged an entertaining wheel-to-wheel dice before Alonso finally passed for fifth place with five laps to go.
Nico Hulkenberg's Force India followed the Australian in seventh, ahead of Button, Magnussen and Hulkenberg's team-mate Sergio Perez.