Lewis Hamilton overtook championship rival Max Verstappen with just six laps remaining to win the Spanish Grand Prix and extend his early lead in the drivers' standings.
The seven-time drivers' world champion appeared to have missed his chance at Barcelona's Circuit de Catalunya when he was left out on old rubber for four laps longer than his rival.
But Mercedes sprung a surprise on Red Bull, stopping Hamilton for a second time, leaving the world champion 24 laps to overturn a 22-second deficit.
Hamilton delivered with an expert comeback drive to extend his lead in the standings over Verstappen to 14 points. Valtteri Bottas finished third for Mercedes ahead of Ferrari's Charles Leclerc and Sergio Perez in the other Red Bull.
"It was a long way to come back from but a good gamble and a really great strategy by the team," he said.
"A one-stop is very hard to pull off and I was about to have a shot at getting past him before I pitted for a second time. I was conflicted but I did what the team asked and that is because there is great trust. It is a remarkable job by every one in this team. What a day."
Hamilton started the race on the backfoot after he lost the lead at the opening bend with his title rival afforded an opening at the first corner and Verstappen did not need a second invitation.
Bolder and braver on the brakes, Verstappen launched his Red Bull down the inside of Hamilton's Mercedes.
Hamilton turned in for the right-hander and came within millimetres of making contact with Verstappen before conceding the position.
A safety car was deployed on the ninth lap after Yuki Tsunoda broke down at Turn 10 but when the racing resumed two laps later, Verstappen left Hamilton trailing to retain the lead.
From there, Hamilton was hot on his heels with the Englishman just half-a-second behind when Verstappen was the first to blink, stopping for tyres on lap 24.
But the Red Bull crew were slow in getting Verstappen's rear-left tyre bolted on his car, appearing to hand the initiative to Hamilton and Mercedes.
However, Hamilton stayed out for four additional laps and with Verstappen, on fresh rubber, lapping faster than his rival, any advantage the world champion had was lost.
Indeed, when Hamilton emerged from the pits on lap 28, he was six seconds adrift. Hamilton was then on a charge, and within a matter of laps he was back on the Dutchman's gearbox.
But with overtaking at this track among the hardest on the calendar, Mercedes sprung a surprise by calling Hamilton in for a second stop with 24 laps of the race to run.
"How far have I got to catch up?" a breathless Hamilton said.
"Currently 22 seconds," came the reply from race engineer, Pere Bonnington. "We have done it before," he added, referring to the 2019 Hungarian Grand Prix when Hamilton gambled on a second pit stop and passed Verstappen for the lead with just three laps to run.
Verstappen, now having to nurse his rubber to the flag, was starting to feel the pressure. "I don't see how we are going to make it to the end," he said with 18 laps still remaining.
Bottas, out of sync with Hamilton, and running in second, was then ordered out of his team-mate's way.
"Lewis is fighting for a win, we are on a different strategy to him," the Finn was told on lap 50. A lap later, Bottas was urged: "Don't hold Lewis up."
Bottas has so often obeyed team orders to the letter, but he did not make it easy for Hamilton with the Englishman having to fight his way past at the left-handed Turn 10 and arguably losing time in his pursuit of Verstappen.
But to the relief of team principal Toto Wolff Hamilton was through, and with 14 laps to go he was 10 seconds adrift of Verstappen.
By the start of lap 59, Verstappen was just 1.5 seconds ahead and on lap 60, Hamilton was within striking range as they sailed down the pit straight.
Hamilton followed Verstappen at over 200mph before jinking to the left of his helpless rival and sailing round the outside for the 98th win of his stunning career.
"That is what we are taking about, Lewis," said Bonnington over the radio. "Nice work." Wolff threw his arms up in the air as his star driver executed a brilliant comeback.
Verstappen pitted the next time around to take on a set of fresh tyres before claiming a bonus point for the fastest lap of the race.
Elsewhere, Daniel Ricciardo was sixth for McLaren, with team-mate Lando Norris eighth. Carlos Sainz split the McLaren drivers by finishing seventh.