Andrea Dovizioso beat Ducati team-mate Jorge Lorenzo in a wet Malaysian Grand Prix to keep his slim MotoGP title hopes alive, as Marc Marquez could only manage fourth place.
In wet conditions, the two factory Ducatis of Dovizioso and Lorenzo had the clear measure of the opposition, although it was the Tech3 Yamaha of Johann Zarco that led the early going.
Marquez fleetingly led into the first corner with a great start from seventh, but ran wide to allow Zarco and Lorenzo through into the top two positions.
Dovizioso settled into fourth and pressured Marquez until finding his way past at the Turn 14 right-hander onto the back straight on the fourth lap, as the top four escaped from the rest of the field.
Zarco, the only one of the top four who opted for a soft compound rear tyre, stretched a lead out front of almost two seconds before Lorenzo began to reel him in.
Lorenzo made his move just before half-distance, with Dovizioso following through soon afterwards to establish a Ducati one-two out front.
With Marquez unable to make an impression on Zarco in fourth, it meant Dovizioso could take the title fight to Valencia by finishing ahead of Lorenzo, who received what appeared to be a coded instruction on his dashboard to move aside.
It took until lap 16 of the 20 for the positions to switch, as Lorenzo ran wide at the final corner to allow Dovizioso through and seal his sixth victory of the year by a margin of 0.748 seconds.
Zarco hung on for his second podium of the year, a further eight seconds back, and a similar margin ahead of Marquez in fourth.
Marquez's championship advantage was cut to 21 points, meaning an 11th-place finish at Valencia will be enough for the Honda rider to seal the crown even if Dovizioso wins.
Poleman Dani Pedrosa slipped to fifth by the end of the opening lap, and remained in that position for the duration, 11s behind team-mate Marquez.
Pramac Ducati's Danilo Petrucci came from last on the grid to a strong sixth place, having suffered a breakdown on the warm-up lap, beating Valentino Rossi on the best of the factory Yamahas by three tenths.
Maverick Vinales could do no better than ninth on the second works M1, behind the Marc VDS Honda of Jack Miller, while Pol Espargaro's KTM completed the top 10.
Scott Redding spent several laps in sixth, but slipped back to 13th in the closing laps behind Alvaro Bautista and Bradley Smith.
Cal Crutchlow was the final points-scorer in 15th after dropping to 21st on the opening lap, while Michael van der Mark missed out on a point in his maiden MotoGP outing on the second Tech3 Yamaha.
Andrea Iannone also failed to score in what turned out to be another dismal outing for Suzuki, as Alex Rins crashed twice before finally being black-flagged for shortcutting his way back to the pits.
Sam Lowes, Karel Abraham and Loris Baz all crashed out too.