Maverick Vinales won a delayed MotoGP season opening Qatar Grand Prix, holding out Ducati's Andrea Dovizioso to win on his Yamaha debut.
Vinales started from pole position and dropped to fifth early, but stormed back into contention in the second half of the race and then kept the Ducati at bay to start life with his new team in style.
After all of Saturday's running was washed out, most of Sunday was dry, although the threat of further rain remained.
A light shower inevitably arrived just three minutes before the scheduled start, and following a pair of delays the race got under way 45 minutes late, with the distance trimmed by two laps to 20.
When it did begin, Tech3 Yamaha's rookie Johann Zarco stole the show.
The Frenchman lined up fourth, but forced his way past Vinales into second at the first corner and then into the lead with a move on Andrea Iannone later on the first lap.
Zarco, who changed to a soft rear tyre on the grid, strolled away at the front of the field, and led by 1.640 seconds after six laps.
However that was the end of his charge, crashing at Turn 2 the next time around.
That handed the advantage to Dovizioso, who built a lead as Marc Marquez, Iannone, Vinales and Valentino Rossi - both Yamahas emerging after a quiet start - fought behind him.
At half-race distance, the top five riders were covered by 1.8s, albeit with Dovizioso a neat second clear at the front.
Iannone crashed out of third at Turn 5 on lap 11, one lap before Vinales and Rossi both passed Marquez, at the first and last corners respectively.
With eight laps to go, Vinales had trimmed Dovizioso's lead to 0.767s, and Vinales took three tenths out of that the next time around.
On laps 14, 15 and 16, Vinales moved past Dovizioso, but only the last move stuck, with the Ducati blasting back past on the main straight the first time and Vinales overshooting braking for Turn 1 on the second.
Vinales looked to have made a decisive move with four laps to go, at Turn 6, but Dovizioso rode past again down the main straight with three laps to go.
The Spaniard had one more move left, getting past on the penultimate lap and doing enough to keep Dovizioso at bay when they crossed the start-finish line the next time around.
He claimed his second career victory by 0.461s over Dovizioso, while Rossi ran with the lead duo but dropped off to be nearly two seconds behind his team-mate at the end.
Marquez faded to finish a lonely fourth, with Honda team-mate Dani Pedrosa fifth after holding off Aleix Espargaro.
From 15th on the grid, Espargaro starred in his first race for Aprilia, recording its best result since returning to MotoGP in 2015.
Pramac Ducati rider Scott Redding was the top satellite rider in seventh, with Jack Miller and rookies Alex Rins and Jonas Folger rounding out the top 10, Suzuki's Rins passing Folger on the last lap.
Jorge Lorenzo started his first race with Ducati in 12th place, but ran off track at Turn 5 on the opening lap and dropped to 16th.
From there, he benefited from attrition to rise as high as ninth, but fell again to 11th.
Both KTMs got home as the Austrian manufacturer began its maiden MotoGP campaign, with Pol Espargaro and Bradley Smith finishing 16th and 17th, ahead of Aprilia rookie Sam Lowes.
Cal Crutchlow's 2017 season started with contact with Rossi at the first corner, and the Briton then fell at Turn 16 on lap four while in 11th place.
He rejoined the race, only to crash his LCR Honda at Turn 13 the next time around, while Alvaro Bautista also crashed out of the race.
RESULTS - 20 LAPS: