Valtteri Bottas took pole position ahead of team-mate Lewis Hamilton as Mercedes secured a front row lockout for Sunday's Azerbaijan Grand Prix. In treacherous cooling conditions on the demanding Baku street circuit, the Finn produced an outright record lap in one minute and 40.495 seconds to outpace the championship leader and defending world champion by 0.059 seconds. It was Bottas's first pole in Baku and the eighth of his career. For Mercedes, it was a fourth consecutive one-two in qualifying. Sebastian Vettel was third for Ferrari while his team-mate Charles Leclerc, who had been fastest in practice, crashed out when he rammed into a wall, during the Q2 part of a prolonged and incident-hit qualifying session.
The session lasted almost two hours overall after big accidents for both Leclerc and in Q1 for Robert Kubica of Williams.
"I am really happy with that," said Bottas. "It was a nice lap and Ferrari has been really strong. Obviously Charles was out by a mistake and as a team we feel really good to be where we are now. It's all about small margins."
Max Verstappen was fourth for Red Bull ahead of Sergio Perez of Racing Point, Daniil Kvyat of Toro Rosso and British rookie Lando Norris of McLaren.
Antonio Giovinazzi was eighth ahead of Alfa Romeo team-mate Kimi Raikkonen with Leclerc taking 10th despite not running in the session.
"I am stupid, I am stupid," said Leclerc after his smash into the same wall that claimed Kubica's Williams earlier in the session.
Kubica's accident was further bad news for the luckless Williams team.
On Friday their British rookie driver George Russell escaped unhurt when his car was wrecked after running over a loose drain cover at high speed in opening practice, which was abandoned and cancelled.
Hamilton said: "It has been so close this weekend. Ferrari looked good, but Valtteri did an exceptional job. For us to get a lockout due to circumstances, I am grateful for that."
Vettel said: "They were a bit quicker. The session was long and the track cooled down."
Bottas was the first pace-setter in Q1 before Vettel responded. Bottas then reclaimed top spot before Leclerc, in 1:41.426, blew his rivals away. At this early stage, Hamilton was 12th before bouncing back to third.
The Baku straight is the longest on the calendar and rewards power at a circuit where 75 per cent of the lap is run at full throttle.
Almost immediately after the chequered flag, Kubica lost control of his Williams after clipping a wall at Turn 8, the castle inside corner, and spearing across track into the barriers.
It was a heavy impact, but he was unhurt and apologised to the team.
This accident resulted in a 15-minutes delay, which meant drivers faced running into a falling sun and colder temperatures.
The Q1 session ended up eliminating Lance Stroll of Racing Point, Romain Grosjean of Haas, Nico Hulkenberg of Renault and the two Williams.
When Q2 finally began, Bottas and Verstappen swapped fastest laps before, after six minutes' action, Leclerc slammed into the wall.
After 26 minutes, action resumed with Vettel out first for Ferrari on the softer red-walled tyres.
He was 12th before the stoppage and needed an improvement to make the top-ten shootout. He climbed to seventh, two places below Leclerc and, on his final run, took fifth from him.
Out from Q2 went Carlos Sainz, 11th for McLaren, Daniel Ricciardo of Renault, Alex Albon of Toro Rosso, Kevin Magnussen of Haas and Gasly, who did not run.
This meant Leclerc went through to Q3, but would not run.
Verstappen led, but it was Hamilton who topped the opening laps four-tenths faster than Vettel, Bottas and Verstappen, who took an additional lap and rose to second, three-tenths off the champion's lap, as the others pitted to prepare for the final flurry.