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.

“I am stupid, I am stupid,” said Leclerc after his smash into the same wall that claimed Kubica’s Williams earlier in the session.

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.

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.