Yamaha's Fabio Quartararo won the Doha Grand Prix on Sunday after overtaking both Johann Zarco and Jorge Martin in the Ducati-powered Pramac Racing bikes in a single lap to leave them fighting for second and third.
MotoGP rookie and pole-sitter Martin led for most of the race before Quartararo moved ahead with five laps to go while Zarco passed his teammate on the final lap to take second.
In what was the closest race in premier class history, the top 15 riders were separated by less than nine seconds at the chequered flag at the Losail International Circuit.
Suzuki's Alex Rins finished fourth while Quartararo's teammate and last weekend's Qatar Grand Prix winner Maverick Vinales finished fifth. Defending champion Joan Mir finished seventh.
"I haven't won many races but this was such a special win," Quartararo said. "I decided to keep the tyres for the end. When I saw Maverick coming, I decided that was the moment to push.
"I worked a lot in preseason to achieve this goal, especially with the pressure after taking the seat from Valentino [Rossi]."
Martin launched himself off the line perfectly to take the lead but the rider who made the biggest gains was KTM's Miguel Oliveira who moved up from 12th to third at the first turn before dropping back.
Rins, who started eighth on the grid, patiently picked his way through the pack and he soon found himself involved in a heated battle for second with Zarco.
Rins was able to slip past Zarco time and again on the corners but he was no match for the Ducati engine on the straights and the Suzuki rider soon lost third place to Francesco Bagnaia from the factory Ducati team.
Behind them, Ducati's Jack Miller and Suzuki's Mir clashed twice, first when Mir bumped Miller wide before the Australian barged him aside with his shoulder on the straight.
Towards the end, Quartararo capitalised on a Bagnaia mistake to move up to third and then reeled in both Martin and Zarco to take the race lead and win -- giving Yamaha a 10-point lead over Ducati in the constructors championship.
Zarco, who finished second last weekend as well, leads the championship after two races -- four points ahead of Quartararo and Vinales.