Valtteri Bottas picked Lewis Hamilton's pocket as the chequered flag fell on an interrupted qualifying session which saw Charles Leclerc and Robert Kubica both crash out.
Bottas' late effort ensured another all-Mercedes front row for an event which, heading into qualifying, looked to favour Ferrari.
However, two red flag periods delayed the session and saw the latter part of it run in much cooler conditions.
That seemed to catch out Ferrari, with Leclerc paying the highest price when he crashed out in Qualifying 2.
Pierre Gasly had set the pace as qualifying begun, fastest of anyone in Qualifying 1, though the the Frenchman is consigned to a pitlane start after missing the weighbridge during practice.
Daniel Ricciardo banked a lap as the qualifying phase ended to just escape the drop zone and climb from 16th to 15th.
The Australian's time came less than half a second before the red flags were thrown after Robert Kubica brushed the inside wall as he turned left to climb by the castle, clouting the outside wall.
It consigned Lance Stroll (Racing Point), Romain Grosjean (Haas), Nico Hulkenberg (Renault), George Russell (Williams), and Kubica to early baths.
A lock up from Leclerc saw him become the second driver to hit the wall in the shadows of the castle, the Ferrari driver locking up and skating into the barrier with just under eight minutes left in Qualifying 2.
It again triggered the red flag, and another delay, leading to qualifying running almost an hour longer than scheduled.
Ricciardo aborted his final flying lap to end Qualifying 2 in 12th place, just over a second off the pace of Max Verstappen who was the fastest of the session.
Also falling by the wayside were Carlos Sainz in 11th, Alexander Albon (Toro Rosso), Kevin Magnussen (Haas), and Gasly who elected not to set a time.
Verstappen then opted for two consecutive timed laps in the latter half of Qualifying 3 in an effort to gain tyre temperature.
It paid dividends, with the Dutchman recording the second fastest time behind Lewis Hamilton, and saw the Red Bull parked before the end of the session.
The remaining eight drivers set a single lap before touring back to the pits and emerging line astern in the final two minutes.
Both Mercedes drivers looked to be compromised as both Hamilton and Bottas sat at pit exit and waited to perform a practice start.
It saw the pair dropped to the back of the queue, and stuck in traffic as they began their final flying lap.
Vettel's second effort saw the German improve to second, though was bumped almost immediately as Bottas recorded a 1:40.495s to steal pole from Hamilton as the chequered flag fell.
Verstappen was demoted to fourth from Sergio Perez (Racing Point), Daniil Kvyat (Toro Rosso), Lando Norris (McLaren), and the two Alfa Romeos of Antonio Giovinazzi and Kimi Raikkonen.
Though he progressed through to the final phase of qualifying, Leclerc took no part owing to his Qualifying 2 mishap.
Sunday's race is set to begin at 2210 AEST.
Results: Azerbaijan Grand Prix, Qualifying
Pos | Num | Driver | Team | Q1 | Q2 | Q3 |
1 | 77 | Valtteri Bottas | Mercedes | 1:42.026 | 1:41.500 | 1:40.495 |
2 | 44 | Lewis Hamilton | Mercedes | 1:41.614 | 1:41.580 | 1:40.554 |
3 | 5 | Sebastian Vettel | Ferrari | 1:42.042 | 1:41.889 | 1:40.797 |
4 | 33 | Max Verstappen | Red Bull Racing Honda | 1:41.727 | 1:41.388 | 1:41.069 |
5 | 11 | Sergio Perez | Racing Point Mercedes | 1:42.249 | 1:41.870 | 1:41.593 |
6 | 26 | Daniil Kvyat | Scuderia Toro Rosso Honda | 1:42.324 | 1:42.221 | 1:41.681 |
7 | 4 | Lando Norris | McLaren Renault | 1:42.371 | 1:42.084 | 1:41.886 |
8 | 99 | Antonio Giovinazzi | Alfa Romeo Racing Ferrari | 1:42.140 | 1:42.381 | 1:42.424 |
9 | 7 | Kimi Räikkönen | Alfa Romeo Racing Ferrari | 1:42.059 | 1:42.082 | 1:43.068 |
10 | 16 | Charles Leclerc | Ferrari | 1:41.426 | 1:41.995 | |
11 | 55 | Carlos Sainz | McLaren Renault | 1:41.936 | 1:42.398 | |
12 | 3 | Daniel Ricciardo | Renault | 1:42.486 | 1:42.477 | |
13 | 23 | Alexander Albon | Scuderia Toro Rosso Honda | 1:42.154 | 1:42.494 | |
14 | 20 | Kevin Magnussen | Haas Ferrari | 1:42.382 | 1:42.699 | |
15 | 10 | Pierre Gasly | Red Bull Racing Honda | 1:41.335 | ||
16 | 18 | Lance Stroll | Racing Point Mercedes | 1:42.630 | ||
17 | 8 | Romain Grosjean | Haas Ferrari | 1:43.407 | ||
18 | 27 | Nico Hulkenberg | Renault | 1:43.427 | ||
19 | 63 | George Russell | Williams Mercedes | 1:45.062 | ||
20 | 88 | Robert Kubica | Williams Mercedes | 1:45.455 |