Valtteri Bottas beat Lewis Hamilton to top spot by just six hundredths of a second in a thrilling qualifying session for the Azerbaijan Grand Prix.
The Mercedes duo took advantage of Charles Leclerc's dramatic crash to lock out the front row in Baku with Sebastian Vettel only third on an evening to forget for Ferrari.
Leclerc had been the favourite to secure the front slot on the grid after dominating the weekend so far.
But after the 21-year-old put his Ferrari in the barriers, Bottas claimed the spoils with his final throw of the dice to beat Hamilton.
The Finn took his second pole in as many races with the sun setting in Azerbaijan’s capital following two crashes which delayed the running by almost an hour.
First, Robert Kubica hit the barriers at the narrow castle section, and then Leclerc did the same.
The young Monegasque clipped the kerb at the left-handed entry to turn eight, and went head-on into the wall on the opposing side of the track.
“I am stupid, I am stupid,” he said furiously over the radio before hitting his car with both hands as he emerged from the cockpit.
John Elkann, the Ferrari chairman, is in Azerbaijan this weekend, and he shook his head in response to his new driver's crash.
“No excuses,” tweeted Leclerc, who is set to start from ninth providing there are no hiccups putting his heavily-damaged car back together.
“I’ve been useless.
“I will push to have a better tomorrow. Sorry to all the people supporting us and even more to the whole team that deserved so much better.”
Leclerc has impressed in his formative Ferrari career, but this accident will dent his hopes of convincing the team to install him as their number one instead of Vettel.
The German will also be frustrated after finishing a third of a second down on Bottas. Kubica had earlier compounded the air of misery at Williams after he became the first victim to fall foul of this tight track.
“I am sorry,” the Pole said on the radio.
Deputy team principal Claire Williams looked pensive, perhaps wondering if this weekend could get any worse.
British rookie George Russell, who finished 19th of the 20 drivers – to continue his record of out-qualifying Kubica at every round – is already using the only spare car available to Williams here after he hit a loose drain cover in practice yesterday and wrote off his chassis.
The British team’s mechanics now face an almighty repair job to ensure Kubica will be able to take part in Sunday’s race.
Lando Norris finished ahead of his team-mate Carlos Sainz, by putting his McLaren in a career-best seventh on the grid.
Sainz finished 11th. Red Bull's Max Verstappen will line up in fourth.