Lewis Hamilton won a tense strategic battle at the Hungarian Grand Prix to head into Formula 1's summer break with a 24-point championship lead.
Ferrari appeared to blow their best chance to challenge the Mercedes driver, delaying a pit stop for Sebastian Vettel long enough to lose their advantage over Hamilton's team-mate Valtteri Bottas and emerge behind the Finn.
It was a critical error that could have cost Vettel second place - but he fought back and passed Bottas with five laps to go.
Bottas misjudged an attempt to defend from Vettel, who passed on the outside on the run to Turn Two. Trying to keep the place from too far back, Bottas locked a wheel, slid onto the kerb, hit Vettel and damaged the Mercedes' front wing.
Vettel emerged unscathed and Bottas carried on, only to have another contact with Red Bull's Daniel Ricciardo when the Australian tried to pass around the outside at Turn One and Bottas locked up and slid into him.
Bottas' troubles allowed Kimi Raikkonen to come through into third place behind his Ferrari team-mate, while Ricciardo passed him on the last lap to take fourth.
Despite the late drama, the big picture is that Ferrari have now lost two races in a row that they might have won in different circumstances.
Hamilton's advantage with nine races to go is almost a race victory and puts him in a strong position for when the season re-starts in Belgium at the end of August.
- 'Hamilton shows he will take some beating as momentum turns'
- Hamilton to 'turn up heat' in second half of season
- Hungarian GP - race results
- 'Did you connect the bottle?' - Raikkonen's water worry
How did Hamilton and Mercedes do it?
Mercedes went into the race pondering how best to maintain the first and second positions they earned thanks to rain in qualifying - had it been dry, they were resigned to the Ferraris being faster.
Mercedes accepted that Ferrari would be faster in the race, too, so it was a case of how best to play the strategy to try to keep Hamilton in the lead.
Hamilton and Bottas led from the start and Vettel passed Raikkonen to run third in the early laps.
The Mercedes were on the ultra-soft tyres, while Vettel was on the more durable softs, planning to run long and attack at the end of the race.
The plan was working well for a while. An early pit stop for Raikkonen on lap 14 triggered a response from Mercedes a lap later with Bottas, and now Vettel was in second behind Hamilton.
But the world champion's tyres were hanging on better than might have been feared and he held an eight-second lead over Vettel until beginning to lose time shortly before his pit stop on lap 25.
That put Vettel in the lead, and by lap 29 the German had enough of a lead over Bottas to make a pit stop and re-emerge in the lead.
But Ferrari preferred to wait, to ensure he did not have too long to run on the ultra-soft tyres in his final stint.
They arguably waited too long. For a few laps, Vettel had five seconds in hand beyond the 20 seconds that would be lost in a pit stop, but from lap 35 Bottas began to eat into Vettel's advantage.
The Finn then unleashed a fastest lap on lap 38, two seconds quicker than he had been going before, and when Vettel pulled into the pits on lap 39 it was now touch and go whether he would get out in front.
A problem fitting the left front wheel delayed Vettel and ensured he emerged behind the Mercedes.
From hoping to attack Hamilton, Vettel now had to try to find a way past Bottas.
- How the Hungarian Grand Prix unfolded
- Listen: Vettel's slow pit stop
- Listen: Bottas' crashes with Vettel and Ricciardo
And despite the Mercedes' fading tyres, and the Ferrari right behind him for 30 laps, Bottas drove superbly to hold on until five laps to go and the critical incident.
Vettel closed in at Turn One, Bottas squirmed under power on the exit and Vettel got the run on the Mercedes into Turn Two.
Bottas then seemed to lose his head.
Not only did he clash with Vettel but he made another error in the incident with Ricciardo, who despite being forced off track caught the Mercedes again. Bottas was ordered by his team to give the place back, perhaps hoping to avoid a penalty when the stewards investigate after the race.
Bottas was given a 10-second penalty but it made no difference to the result.
Behind the big two
Ricciardo drove well to fight from 12th on the grid to finish fourth for Red Bull, despite the damage from the Bottas incident. Their second driver Max Verstappen retired from fifth place in the early stages with the latest in a series of engine problems, causing the Dutchman to swear into the radio at his frustration at the repeated problems.
Pierre Gasly took a strong sixth for Toro Rosso, from the same place on the grid after excelling in qualifying, ahead of Haas driver Kevin Magnussen.
And there was finally some good news for Fernando Alonso on the two-time world champion's 37th birthday. McLaren made the same strategy as Vettel work beautifully, jumping Alonso and team-mate Stoffel Vandoorne ahead of Renault's Carlos Sainz, Haas' Romain Grosjean, Toro Rosso's Brendon Hartley and Renault's Nico Hulkenberg to take eighth.
Sadly for the under-pressure Vandoorne, after his best race for some time, the Belgian's gearbox broke with 19 laps to go and he had to retire.
Driver of the day - Lewis Hamilton
Nearly four weeks off, until F1 reconvenes at the Belgian Grand Prix on the magnificent Spa-Francorchamps circuit, followed by the Italian Grand Prix at Monza a week later. Can Ferrari rebound? They need to.