Marc Marquez notched up his fourth victory of the MotoGP season after beating Danilo Petrucci in a pulsating wet-weather duel at Misano, drawing level with Andrea Dovizioso at the top of the standings.
Pramac Ducati rider Petrucci inherited the lead of the race on lap 7 of 28, as Ducati's Jorge Lorenzo - who made a lightning start from fifth on the grid to lead the opening lap - crashed out at Turn 6 while holding a comfortable lead.
Petrucci was never able to shake off Marquez, who managed to cling to the Italian's tail until the closing laps before passing for the lead into Turn 1 at the start of the final lap to seal victory.
Lorenzo was the class of the field in the early laps when conditions were at their worst, streaking away from the field with a succession of fastest laps, with Marquez's Honda slotting behind, with the second works Ducati of Dovizioso in third.
Petrucci meanwhile had worked his way up from eighth on the grid to fourth by the end of the third lap, passing struggling poleman Maverick Vinales for the place.
Two laps later, he'd picked off Dovizioso for third, and the following tour dispatched Marquez to move into second, albeit more than three seconds behind Lorenzo until the Spaniard's demise.
Dovizioso faded from the picture as the race entered its final phase, as Marquez upped the pressure on Petrucci - helped by a small moment for the Italian rider with five laps to go - before taking the lead on the last lap to deny Petrucci his maiden MotoGP win.
With Dovizioso coming home third, 10.5 seconds behind Marquez, it means the pair are now tied on 199 points - with Vinales 16 behind after taking fourth place.
Vinales had to contend with privateer Honda pairing of Jack Miller and Cal Crutchlow in the early laps, until the British rider crashed out at Turn 3 on the same lap as Lorenzo.
Miller couldn't live with Vinales' pace thereafter, and was eventually passed for fifth by Ducati wildcard Michele Pirro.
Tech 3 Yamaha rider Johann Zarco had been on course for seventh, only to run out of fuel on the final corner.
The Frenchman heroically pushed his satellite Yamaha down the length of the start/finish straight and over the line, but not before dropping down to 15th place.
That promoted Pramac Ducati's Scott Redding to seventh, ahead of Suzuki novice Alex Rins and the second Tech 3 bike of Jonas Folger. KTM's Bradley Smith picked up his best result of the season in 10th.
Crutchlow finished 13th after remounting his LCR Honda, one place ahead of the second works Honda of Dani Pedrosa, who struggled for tyre temperature and dropped towards the rear of the pack early on.
Aprilia duo Aleix Espargaro and Sam Lowes both crashed out of top 10 places, as did Avintia pair Loris Baz and Hector Barbera, while Suzuki's Andrea Iannone pulled into the pits with a reported case of arm pump.
|2||Danilo Petrucci||Pramac Ducati||28||1.192s|
|6||Jack Miller||MVDS Honda||28||24.882s|
|7||Scott Redding||Pramac Ducati||28||33.872s|
|9||Jonas Folger||Tech3 Yamaha||28||54.082s|
|12||Alvaro Bautista||Aspar Ducati||28||1m17.356s|
|13||Cal Crutchlow||LCR Honda||28||1m35.588s|
|15||Johann Zarco||Tech3 Yamaha||28||2m02.212s|
|16||Loris Baz||Avintia Ducati||27||1 Lap|
|17||Karel Abraham||Aspar Ducati||27||1 Lap|
|-||Tito Rabat||MVDS Honda||19||Retirement|
|-||Hector Barbera||Avintia Ducati||11||Retirement|