Baku: Ferrari's championship leader Sebastian Vettel smiled with relief Saturday after he had claimed pole for Sunday's Azerbaijan Grand Prix ahead of a revived Lewis Hamilton for Mercedes in a crash-strewn qualifying session.
The German, who leads the defending four-time champion by nine points after three races this season, clocked a best lap in one minute and 41.498 seconds to sweep to the prime starting spot.
It was an emphatic demonstration of his and Ferrari's pace after he had struggled in practice on Friday. It was his third consecutive pole position and the 53rd of his career.
"In the end, I knew I had the car I wanted and it did what I wanted... The first lap was good and it was good enough in the end so I am happy," said Vettel.
Hamilton was 0.179 seconds adrift after an improved showing that left him ahead of Mercedes team-mate Valtteri Bottas, Daniel Ricciardo and his Red Bull team-mate Max Verstappen.
"That was close," said Hamilton.
"We did the best job we could and I think I lost a little bit in the final sector, but Sebastian did a great job. We are in the mix and I am hoping to give him a hard time in the race."
Bottas said: "We can fight them here and we are starting very close. This race can be crazy, but we have a good starting point."
Kimi Raikkonen wound up sixth in the second Ferrari after an eventful session and a huge slide on his final flying lap.
Esteban Ocon was seventh ahead of his Force India team-mate Sergio Perez, Nico Hulkenberg who faces a five-place grid penalty for a gearbox change, and his Renault team-mate Carlos Sainz.
In cool and overcast conditions, with a strong breeze, the opening Q1 session began briskly, but was soon interrupted when Romain Grosjean's Haas car came to a halt in an escape road at Turn Three, his gearbox jammed.
He was unable to rejoin while the action was controlled by yellow flags. As a result, Ocon was briefly fastest ahead of Hulkenberg and Sergey Sirotkin, back in action after his crash in morning practice.
- 'Unacceptable' -
For Hulkenberg, it was encouraging despite knowing he faced a five-place grid penalty for a gearbox change.
More drama followed in the final minutes of Q1 when Pierre Gasly almost clipped his Red Bull team-mate Brendon Hartley. Taking avoiding action, Gasly bounced over the kerbs at Turn 15 and into an escape road.
The Frenchman was furious, screaming at the New Zealander over the team radio. Told Hartley had a puncture he said: "Unacceptable".
"Sorry guys," said Hartley. "I was trying to get out of the way, but it was too late. I went the wrong way. I feel pretty stupid."
This incident resulted in them both being eliminated in 17th and 19th positions along with the luckless Grosjean. Also out went Stoffel Vandoorne of McLaren and Marcus Ericsson of Sauber.
In Q2 more drama saw Raikkonen going straight on, at Turn 15, and Lance Stroll also left the track.
Bottas led the way ahead of Verstappen and Vettel before Raikkonen went off again and a persistent Hamilton topped the charts ahead of his team-mate by 0.003 seconds until Raikkonen, racing with fury on a set of ultra-softs, roared to the head of the lap-times in the final seconds.
All this left Stroll in 11th place ahead of Williams team-mate Sirotkin, Fernando Alonso of McLaren, Charles Leclerc of Sauber and Kevin Magnussen of Haas.
On their first flying runs, Vettel outpaced Hamilton by three-tenths ahead of Bottas and the Red Bulls with Raikkonen sixth, following a scary off-road excursion at Turn 16.
"I was on the kerb and couldn't steer," said the Finn.