Daniel Ricciardo drove a masterful race to fend off Sebastian Vettel's Ferrari and win the Monaco Grand Prix in a stricken Red Bull.
The Australian dominated the weekend and led from pole but shortly after his only pit stop suffered a power loss at one-third distance.
Ricciardo managed to hold off Vettel for the remaining 50 laps, as Lewis Hamilton took third in his Mercedes.
The result means Hamilton leads Vettel by 14 points in the championship.
Ricciardo moves into third place, 38 points adrift.
- 'A display of sensitivity and control' - Andrew Benson on Ricciardo
- Ricciardo plays down title bid after win
- 'It was a super-unexciting' - Hamilton & Alonso bemoan 'boring' race
Redemption for Ricciardo
Ricciardo had said in the build-up to the race that he felt Monaco owed him a win, following the pit-stop bungle that cost him victory in 2016, but admitted he would have to "earn it".
His words turned out truer than he could have imagined at the time, as a race that had looked to be turning into a relatively easy cruise suddenly became filled with jeopardy.
"Two years later I finally feel like redemption has arrived," Ricciardo said.
"We had a lot to deal with during the race. I felt loss of power and I thought the race was done. I got home just using six gears. Thanks to the team I got it back.
"There were a few doubts getting it to the end of the race but we won Monaco."
- 'I don't know how you did that, mate!' - Ricciardo stuns Red Bull
- Listen: Ricciardo encounters engine issues
- Listen: Chequered Flag - Monaco Grand Prix Review
Ricciardo led away from pole, fending off the faster-starting Vettel, and controlled the opening part of the race, making his first pit stop on lap 17, to cover the German's stop a lap before.
With all drivers managing their tyres, and lapping seconds off the limit to ensure they needed to do only one stop, the race seemed already settled.
But then Ricciardo came on the radio complaining of a lack of power. The team said they could see what the problem was - but did not say to avoid rivals finding out - and told him it would not improve.
It turns out he lost the MGU-K - the part of the hybrid system that recovers energy from the rear axle and redeploys it. Team boss Christian Horner said it cost him 2.5 seconds a lap and 25% of engine power, or about 225bhp.
Ricciardo had held a three-second lead after the pit stops, but now had Vettel right behind him and knew he faced a difficult, exhausting race managing the engine problem while ensuring the German did not get close enough to try a pass.
He was helped by the arguably ridiculous situation of drivers lapping four or five seconds off their potential maximum pace to ensure their tyres lasted.
This was the case throughout the race, whether drivers were on the fragile hyper-soft qualifying tyres, or on the two harder options, the super-soft and ultra-soft.
As such, the race provided uncomfortable memories of the first six years of Pirelli's tenure in F1, before it was asked to provide more raceable tyres to enable drivers to push harder in the faster, more demanding cars that were introduced in 2018.
Ricciardo was one of the drivers centrally involved in forcing that to happen, but he will not care about it right now, after finally taking a well-deserved and overdue win at the most prestigious event of the year.
"I don't know how you did that," engineer Simon Rennie said to Ricciardo in congratulating him over the radio on the slowing-down lap.
Horner said: "You have done an amazing job today. That is right up there with what Schumacher did... and it is payback for 2016."
Horner was referring to Michael Schumacher's drive in the 1994 Spanish Grand Prix, when the German finished second for Benetton with only fifth gear.
Vettel, knowing overtaking was all but impossible, followed in his former Red Bull team-mate's wheel tracks until dropping back in the final five laps or so when his tyres ran out of grip.
Hamilton, who for a time was wrongly concerned the ultra-soft tyres fitted at his pit stop would not make the end, will probably look at the race as relatively successful damage limitation on a weekend Mercedes always expected to be difficult.
The second Ferrari and Mercedes of Kimi Raikkonen and Valtteri Bottas took fourth and fifth.
Alonso's first retirement
Best of the rest was Force India's Esteban Ocon, converting an excellent sixth on the grid into the same place as the finish but at the same demonstrating the extent of pace management at the front by moving on to the tail of Bottas' Mercedes in the closing laps.
Toro Rosso's Pierre Gasly benefited from McLaren driver Fernando Alonso's first retirement of the season with a broken gearbox to take seventh.
The Frenchman, who did a remarkable 37-lap stint on the hyper-soft tyres at the start of the race, had to fend off the Renault of Nico Hulkenberg and Red Bull's Max Verstappen to the end.
Verstappen drove a well-judged race to recover from his back of the grid start after a crash in practice caused him to miss qualifying. The Dutchman made a series of overtakes and balanced aggression with caution in a way he has struggled to do on so many occasions so far in his incident-strewn season.
With six laps to go, Sauber's Charles Leclerc, running 15th, smashed into the back of Brendon Hartley's Toro Rosso at the chicane when he suffered a brake failure, bringing out the virtual safety car, but it changed nothing about the result.
Driver of the day - Daniel Ricciardo
Canada - and a race very different from Monaco. Another street circuit, but a fast one, where Hamilton excels, racing is furious, overtaking common and where both Renault and Honda have major engine upgrades of which much are expected. If Renault's lives up to expectations, Ricciardo could conceivably become a major title contender.