Nico Rosberg will start the inaugural Baku Grand Prix from pole position while Lewis Hamilton's wretched qualifying ended when he smacked the wall.
It boiled down to a final lap for the Mercedes drivers who were having a tough time in Q3.
But while Rosberg came good, posting a 1:42.758, Hamilton clipped wall with the front right of his W07 which damaged the car.
The session was red flagged with 2:05 on the clock with all the remaining nine drivers, exclusing Rosberg, heading out for a final dash when it restarted.
However with the tyres already well used none were able to edge either Rosberg or Sergio Perez although Daniel Ricciardo did improve to third.
That means a front row start for the Red Bull driver as Perez faces a five-place grid penalty for a gearbox change in the wake of his FP3 crash.
Sebastian Vettel was fourth ahead of Kimi Raikkonen as Ferrari put their earlier troubles behind them.
It was a good session for Felipe Massa, who finished P6 ahead of Daniil Kvyat and Valtteri Bottas.
Max Verstappen and Hamilton completed the top ten.
Jenson Button was the evening's biggest loser as he qualified down in 19th place, behind the two Manors of Rio Haryanto and Pascal Wehrlein.
1 Rosberg Mercedes 1:42.758
2 Perez Force India 1:43.515 +0.757
3 Ricciardo Red Bull 1:43.966 +1.208
4 Vettel Ferrari 1:43.966 +1.208
5 Raikkonen Ferrari 1:44.269 +1.511
6 Massa Williams 1:44.483 +1.725
7 Kvyat Toro Rosso 1:44.717 +1.959
8 Bottas Williams 1:45. 246 +2.488
9 Verstappen Red Bull 1:45.570 +2.813
10 Hamilton Mercedes 2:01.954 +19.196
11 Grosjean Haas 1:44.755
12 Hulkenberg Force India 1:44.824
13 Sainz Toro Rosso 1:45.000
14 Alonso McLaren 1:45.270
15 Gutierrez Haas 1:45.349
16 Nasr Sauber 1:46.048
17 Haryanto Manor 1:45.665
18 Wehrlein Manor 1:45.750
19 Button McLaren 1:45.804
20 Ericsson Sauber 1:46.231
21 Magnussen Renault 1:46.348
22 Palmer Renault 1:46.394
Experience the full, extensive coverage of Roland Garros 2016 for two entire weeks on FOX Sports Play, where you can watch all the matches, highlights, interviews, bloopers and much more. Don’t miss it!