Ferrari's Sebastian Vettel dominated the Canadian Grand Prix to retake the championship lead as Lewis Hamilton could finish only fifth for Mercedes.
Vettel converted pole position into a lead at the first corner and was never headed as he kept Mercedes' Valtteri Bottas at arm's length throughout the race.
Red Bull's Max Verstappen took third after a valiant but unsuccessful attempt to pass Bottas through the first two corners.
Hamilton started fourth but dropped back to finish fifth and is a point behind Vettel a third of the way through the season.
In a bizarre end, the chequered flag was waved a lap too early by model Winnie Harlow, only for Vettel to say over team radio: "Tell them not to wave the flag when it's not done."
He continued on his way to take it again after the correct 70 laps, however the race was declared at 68 laps, based on the official count back rules, as a result of the mistake.
World champion Hamilton was struggling with engine temperatures in the first part of the race, which forced Mercedes into an earlier than planned pit stop for fresh tyres so they could add more cooling to the car.
It meant the Briton lost a place to Red Bull's Daniel Ricciardo at his stop, and Hamilton had a nervy moment when Ferrari's Kimi Raikkonen emerged alongside him after his much later stop.
Hamilton managed to fend the Finn off, and even pulled away despite having tyres 16 laps older than Raikkonen's.
Ferrari unnerved by eventful start
Vettel had failed to convert his previous two pole positions, in Azerbaijan and China, into wins. Ferrari were out-foxed on strategy in Shanghai and Vettel made an error in Baku, but there was never any danger of that happening in Montreal.
The German made a strong start and, as Bottas was left to fend off Verstappen's attack, the Ferrari started to sprint clear, only for the race to be put under a safety car following a huge crash between Toro Rosso's Brendon Hartley and Williams' Lance Stroll.
Hartley was making a move on Stroll through the flat-out Turn Five. The Canadian edged him wide and the Williams started to slide, collecting Hartley and forcing the Toro Rosso into the barriers.
It leapt in the air, half-mounted Stroll's Williams, and the two careered together into the run-off area.
Stroll was unhurt but Hartley, who was seen walking back to the pits, was sent to hospital for a scan, returning to the circuit after the race following a normal ECG result.
The race restarted on lap five and Vettel again sprinted clear, opening an advantage of 1.2 seconds in one lap and 3.4secs by lap 10. The race was effectively over, as Vettel controlled events from then on.
Bottas drove strongly to take second, despite a late charge from Verstappen as the Finn struggled to manage a lack of fuel, crossing the line just 0.9secs clear of the Dutchman.
After fending off Raikkonen, Hamilton began to pile pressure on Ricciardo in the last 20 laps.
With eight laps to go, his engineer gave him the option of turning the engine down and settling for fifth, but Hamilton insisted he keep trying.
He was hoping to benefit as they picked their way through the battle between three lapped cars and it led to a tense climax, but Hamilton was unable to pass.
'Not bothered' about title lead
Vettel, for whom this was a 50th victory, said: "Perfect is a good way to describe it. I said yesterday how much this place means for Ferrari. To have a race like we have today is unbelievable."
He said he was "not too bothered" about the fact he was back in the lead of the championship, saying the first Ferrari win since 2004 at a track that is synonymous with the team because of the Canadian icon Gilles Villeneuve - a Ferrari driver from 1977-82 before his death at the Belgian Grand Prix - was more important.
"It is a good side effect, but today at Circuit Gilles Villeneuve we had Jacques driving his father's car earlier, which was very emotional and to have a win with me driving makes me very proud."
Woe is McLaren
Behind the big six, Nico Hulkenberg and Carlos Sainz took seventh and eighth for Renault, striking an important blow against McLaren in their battle for fourth place in the constructors' championship.
Fernando Alonso was on course to score at least a point for 10th place on the weekend in which he has been celebrating his 300th grand prix.
But he retired with 30 laps to go with a broken exhaust, his second retirement in a row.
Team-mate Stoffel Vandoorne could finish only 16th after running the entire race on a set of tyres that were fitted at the end of lap one during the safety-car period.
It was a dismal race for McLaren, their worst performance of the season and raised concerns their claims of making progress with the car are not coming to fruition.
Behind the Renaults, Force India's Esteban Ocon took ninth and Sauber's Charles Leclerc the final point in another impressive performance by the Monegasque rookie.
Driver of the day
What happens next?
F1 returns to France for the first time in 10 years, and the Le Castellet circuit in Provence for the first time since 1990 in two weeks' time, at the start of a run of three races in three weeks culminating with the British Grand Prix. Another tight and unpredictable battle is expected.