Nico Rosberg will start the European Grand Prix from pole position after setting the pace in qualifying at the Baku City Circuit.
The German put in a 1m42.758 in the final few minutes of the session to move up to first place, just prior to the red flags emerging.
The session was briefly stopped after his team-mate Lewis Hamilton clipped the Turn 11 barrier and damaged his car. He was forced to stop on the track and will start 10th.
Sergio Perez was second fastest but he has a five-place gearbox change penalty, which means Daniel Ricciardo will inherit the final spot on the front row.
Incredibly Ricciardo and former team-mate Sebastian Vettel set identical times, but the Red Bull put his lap in first and was third quickest. Vettel was fourth, ahead of Kimi Raikkonen and Felipe Massa.
Daniil Kvyat, Valtteri Bottas and Max Verstappen were next up. Hamilton will complete the top 10 on the grid.
Romain Grosjean just missed out on Q3 and was the first to be eliminated in the second session, just ahead of Nico Hulkenberg.
The Force India driver suffered a spin during the 15-minute segment and was a surprise addition to the drop-zone, having finished high up the order in practice.
He was bumped down by a late improvement from Hamilton and didn’t have enough fuel to complete another time.
Carlos Sainz Jr., Fernando Alonso, Esteban Gutierrez and Felipe Nasr completed the order in the second session.
Rio Haryanto starred in qualifying, ending the first segment in 17th place. He was the first driver eliminated, ahead of his Manor team-mate Pascal Wehrlein.
Jenson Button struggled and was next up, with Marcus Ericsson, Kevin Magnussen and Jolyon Palmer completing the drop-zone.