Maverick Vinales capitalised on a last lap mistake by Valentino Rossi to clinch his third victory of 2017 in a heart-stopping the French Grand Prix at Le Mans, where home hero Johann Zarco sealed a dream runner-up finish.
Movistar Yamaha rider Rossi snatched the lead from team-mate Vinales with two laps to go and appeared to be in control until disaster struck on the final lap.
A mistake on the brakes gifted Vinales the lead and as Rossi attempted to fight back, he slid off into the gravel at turn 11.
Reigning world champion Marc Marquez was left empty-handed when he slid out of fourth place, losing the front of his Repsol Honda at turn 3.
Zarco, who started from third place on the front row, shot into the lead on the first lap from Vinales, with Rossi overtaking Marquez to slot into third place.
Running the softer front and rear Michelin tyres, Zarco began to put the hammer down on his satellite M1 and opened a slight gap over Vinales.
By lap seven, Vinales was right on Zarco's tail and he dived into the lead on the brakes at turn 3, with Rossi holding station in third ahead of Marquez and Cal Crutchlow.
A mistake by Rossi allowed Marquez to close the gap on lap 12 as the top four bunched up. Pedrosa was now up to fifth on the Repsol Honda after banging fairings with Crutchlow, who had dropped back to seventh behind Dovizioso.
Vinales, Zarco and Rossi began to drop Marquez, who was being closed down by team-mate Pedrosa. On lap 18, Marquez's race came to an abrupt halt when he appeared to lose the front of his Honda at turn 3.
Rossi was now looking menacing behind Zarco and the Italian made his move at the start of lap 23, passing the Frenchman on the brakes at T3.
At this point Vinales was 0.8 seconds in front, but Rossi quickly bridged the gap and he was soon in a position to challenge Vinales, lining up his move a turn 3 on lap 25 before making the pass stick on the following lap to take the lead.
A grandstand finish was in store and although Rossi immediately made a slight break, Vinales responded to put pressure on the nine-time world champion.
Rossi had victory in his hands but first, a mistake on the brakes let Vinales through before the 38-year-old blew his hopes at turn 11, sliding out of contention.
Vinales wrapped up his third win of the season by 3.1 seconds from Zarco, who was more than four seconds clear of the late-charging Dani Pedrosa.
Dovizioso held off Crutchlow for fourth, with Lorenzo taking a solid sixth by 1.7 seconds in front of Jonas Folger (Tech 3 Yamaha).
Jack Miller (EG 0,0 Marc VDS Honda), Loris Baz (Avintia Ducati) and Andrea Iannone on the Ecstar Suzuki were the top 10.
Red Bull KTM riders Pol Espargaro and Bradley Smith were in the points, finishing 12th and 13th respectively, with Sam Lowes also earning two points the Briton finished 14th on the Gresini Aprilia ahead of Sylvain Guintoli, who was standing in for injured Suzuki rider Alex Rins.
Alvaro Bautista was a faller on the first lap on the Aspar Ducati, while several retirements included Hector Barbera, Scott Redding, Karel Abraham and Aleix Espargaro.
1.Maverick Vi?ales2.Johann Zarco3.Dani Pedrosa4.Andrea Dovizioso5.Cal Crutchlow6.Jorge Lorenzo7.Jonas Folger8.Jack Miller9.Loris Baz10.Andrea Iannone11.Tito Rabat12.Pol Espargaro13.Bradley Smith14.Sam Lowes15.Sylvain Guintoli