Sergio Perez won the Azerbaijan Grand Prix after Red Bull teammate Max Verstappen crashed out of the lead with a tyre failure and Lewis Hamilton made a mistake following a red-flag restart to drop from second to last.
Verstappen crashed at over 200mph on lap 46 of 51 when his left rear tyre exploded on the pit straight and speared his car into the barriers.
The incident resulted in the race being suspended three laps later, setting up a two-lap sprint to the flag at the end.
When the race got back underway, Perez made a slow start from pole but as Hamilton went to make a move for the lead, the Mercedes driver locked his front tyres and ended up in the run-off area.
It later emerged that he had knocked his "brake magic" switch on by accident -- a function on the car designed to heat the front tyres before a race start or restart by changing the brake balance.
Left on, the "brake magic" likely contributed to Hamilton's lock-up.
Perez then retained the lead for the remaining two laps to take the second victory of his career and his first for Red Bull.
Verstappen walked away from his accident unharmed and, remarkably, his championship lead also remained intact after Hamilton's mistake at the restart saw the Mercedes driver finish 16th and last.
Verstappen's was the second tyre failure of the race after Lance Stroll had a similar incident on lap 31 of the race.
Both incidents are being investigated by Pirelli and it was not clear if debris on the track was a factor in the accidents.
The carnage at the front saw Sebastian Vettel take second place after starting 11th on the grid -- his first podium since joining Aston Martin from Ferrari at the start of the year.
Pierre Gasly took third after losing a place and then re-passing Charles Leclerc in the two-lap sprint at the end.
Leclerc, who started on pole, finished fourth after struggling for performance throughout the race after an impressive showing in qualifying.
Lando Norris took fifth place ahead of Fernando Alonso, who made a late charge through the field following the restart.
Yuki Tsunoda took seventh ahead of Carlos Sainz, who made a mistake after his pit stop and dropped down the order, Daniel Ricciardo in ninth and Kimi Raikkonen in tenth.
Mercedes scored zero points from the Baku weekend, meaning it is now 26 points adrift of rivals Red Bull, after Valtteri Bottas rounded off a disappointing weekend with a 12th place finish despite not having any clear issues.