Red Bull's Daniel Ricciardo emerged a shock winner of a chaotic Azerbaijan Grand Prix featuring Formula 1 title rivals Sebastian Vettel and Lewis Hamilton controversially clashing behind the safety car.
Hamilton and Vettel had a on-track run-in while the race was neutralised, earning Vettel a penalty that would have given Hamilton a comfortable cruise to victory had the Mercedes' headrest not come close.
Those dramas left Ricciardo, who qualified 10th and looked well and truly out of contention after stopping early to have debris cleared out of a brake duct, in position to take his fifth grand prix victory.
Ricciardo headed home Valtteri Bottas and Williams rookie Lance Stroll, who picked up a maiden podium just two weeks after his first F1 points finish.
Bottas had been a lap down after a first-lap collision with Kimi Raikkonen but was allowed to unlap himself during one of the race's many interruptions.
Chaos ahead allowed him to find his way into third, and he reeled in Stroll before inching ahead of the Williams in a near-photo-finish for second.
The Bottas/Raikkonen clash happened as the Ferrari got ahead of him for second into Turn 2 on lap one after the Mercedes lost momentum with wheelspin out of the first corner.
Bottas kept to the inside line, bounced off the kerb and into Raikkonen, who tagged the wall but continued in fifth while Bottas limped to the pits.
That allowed Vettel into second behind Hamilton, and he was trailing by three seconds when the race's first safety car appeared on lap 11 of 51 as Daniil Kvyat's Toro Rosso parked on track.
Max Verstappen was pressuring Sergio Perez for third at this point, but had to retire with an engine problem.
The safety car lasted for several laps and allowed all the leading runners to swap their super-softs for softs.
Hamilton sped up early on the main straight for the lap 16 restart and immediately established a lead over Vettel, who had to fend off pressure from Perez, while Raikkonen fell behind Felipe Massa and Esteban Ocon to sixth.
The race was immediately suspended again due to debris in several parts of the circuit, and another chaotic restart followed a few laps later.
First, Vettel made contact with the rear of Hamilton's car as the leader tried to back the pack up for the restart.
Vettel was irate, pulling alongside Hamilton and gesticulating at his rival on the exit of Turn 15 - as his Ferrari whacked against the side of the Mercedes.
Vettel then had to fend off Massa and Perez into Turn 1, although he kept position successfully again.
Instead, there was drama for the Force Indias, as Ocon tried to edge past Perez on exit of Turn 2 but made violent contact, with Raikkonen picking up a damaging puncture from their debris.
Red flags eventually came out this time. Perez and Raikkonen required long periods in the garage for repairs, while Ocon dropped to the back.
At the restart after a 20-minute stoppage, Hamilton and Vettel - now back on super-softs - maintained position with relative ease, as Ricciardo dived into third past both Stroll and Massa, who retired due to a broken rear damper shortly afterwards.
That move was crucial for Ricciardo as soon afterwards Hamilton was called to the pits for a loose headrest to be replaced and Vettel's 10-second stop-go penalty was imposed.
Ricciardo was left free to lead to the finish, while Vettel and Hamilton, now in that order, fought back through the field in tandem.
But they could do no better than fourth and fifth, catching the Bottas/Stroll battle on the final lap.
Ocon and Haas driver Magnussen had both run in a podium position after the red flag, but were shuffled back to sixth and seventh in the end.
Carlos Sainz Jr recovered from a first-lap spin - that he blamed on team-mate Kvyat rejoining from the run-off area - to take eighth, with Fernando Alonso scoring McLaren-Honda's first points of the season in ninth.
The Sauber of Pascal Wehrlein took 10th after a battle with team-mate Marcus Ericsson that included contact before the team asked Ericsson to let Wehrlein through as Stoffel Vandoorne gained on them on fresh tyres.
Vandoorne could not pass either Sauber and finished 12th.
Romain Grosjean was a lap down in 13th after an afternoon of brake problems.
Raikkonen and Perez's repaired cars were eventually retired, while both Renaults went out early - Jolyon Palmer with engine problems and Nico Hulkenberg after clipping a wall while sixth.
RESULTS - 51 LAPS:
|1||Daniel Ricciardo||Red Bull/Renault||2h03m55.573s|
|6||Esteban Ocon||Force India/Mercedes||30.298s|
|8||Carlos Sainz Jr.||Toro Rosso/Renault||49.400s|
|13||Romain Grosjean||Haas/Ferrari||1 Lap|
|-||Sergio Perez||Force India/Mercedes||Collision|
|-||Max Verstappen||Red Bull/Renault||Engine|
|-||Daniil Kvyat||Toro Rosso/Renault||Electronics|
|9||Carlos Sainz Jr.||29|