Valtteri Bottas snatched pole position for the Azerbaijan Grand Prix on Saturday in an incident-packed qualifying session that saw Mercedes lock out the front row and Ferrari favourite Charles Leclerc crash out.
The Finn lapped the six-km Baku street circuit in one minute, 40.495 seconds, just 0.059 seconds faster than teammate and championship leader Lewis Hamilton.
Sebastian Vettel, the sole Ferrari driver chasing pole after Leclerc crashed out in the second phase of qualifying, will line up in third place after his fastest lap was 0.302 seconds off Bottass pace.
Hamilton had been fastest after the first flying laps in the third and final phase but Bottas found the extra speed just when it mattered.
Ferrari had started the session looking dominant after Leclerc had led every practice session.
However, the Monegasque hit the wall. He will still start ninth, however.
With the session running late after two lengthy red-flag delays, and with temperatures dropping and no slipstream, Vettel was unable to extract the lap time.
Robert Kubica brought out the first red flag, the Pole ploughing his Williams into the barriers at exactly the same spot as Leclerc in the opening phase.
That crash was the latest blow on a difficult weekend for struggling Williams with rookie George Russell striking a loose manhole cover in Friday practice and wrecking his car.