Oscar Piastri won the Azerbaijan Grand Prix and sent McLaren top of the constructors' standings in a race that finished with a virtual safety car after a penultimate lap collision between Ferrari's Carlos Sainz and Red Bull's Sergio Perez.
Ferrari's pole-sitter Charles Leclerc, who was overtaken by Piastri on the 20th of 51 laps and then battled nose-to-tail before his tyres faded, came second with George Russell inheriting third for Mercedes after the Sainz-Perez collision.
Red Bull's Formula One leader Max Verstappen finished fifth, just behind his closest title rival Lando Norris, who started 15th for McLaren and ended up fourth with a bonus point for fastest lap.
Triple champion Verstappen's lead over Norris, who reeled in a 15 second gap and passed the Dutch driver on lap 49 thanks to his fresher tyres, was cut from 62 points to 59.
McLaren are now 20 points clear of Red Bull in the standings with seven rounds remaining.
"That was probably the most stressful afternoon in my life," said Piastri, after soaking up relentless pressure from Leclerc to take his second career win.
"It definitely goes down as one of the better races of my career."
The top two had duelled for lap after lap, with the Ferrari driver trying in vain to use the DRS drag reduction to get past Piastri until he faded and fell into the clutches of Perez and Sainz.
Fernando Alonso was sixth for Aston Martin with Williams benefiting from the late crash to see Alex Albon finish seventh with Argentine rookie Franco Colapinto following him home in eighth.
Seven times world champion Lewis Hamilton was ninth for Mercedes, after starting in the pit lane, and British rookie Oliver Bearman collected the final point for Haas as a stand-in for suspended Kevin Magnussen.