Sakhir - Championship leader Sebastian Vettel will start his 200th F1 race from pole position after he and Ferrari team-mate Finn Kimi Raikkonen locked out the front row for Sunday's Bahrain Grand Prix.
The German secured his 51st career pole with a supreme lap in the dying seconds of a tense floodlit qualifying session in which Ferrari were dominant.
"Yes, P1! Pole position,” said Vettel.
"That was a lion lap. That was quite intense… I was happy with my first run until I tossed it away in the last corner so I stayed away from that kerb in the second run.
"The car has been excellent here all weekend."
Valtteri Bottas was third fastest for Mercedes behind the two Ferraris, but ahead of his team-mate Lewis Hamilton who has a five-place grid penalty after an overnight gearbox change and starts from ninth.
That promotes Australian Daniel Ricciardo from fifth to fourth for Red Bull ahead of Frenchman Pierre Gasly of Toro Rosso and Dane Kevin Magnussen of Haas.
Nico Hulkenberg was eighth for Renault ahead of Esteban Ocon for Force India and Carlos Sainz in the second Renault.
"Not ideal - far from ideal in the last run with the traffic," said Raikkonen, the 2007 champion.
"But what can I do? Tomorrow is the main thing - that’s when we get the points."
Bottas said: “It felt ok. The laps were getting better, but these guys in the red cars! It’s going to be a close race.”
It is Ferrari’s first pole position in Bahrain since 2007 when Brazilian Felipe Massa turned it into a victory ahead of then-rookie Hamilton.
"Not easy," said Hamilton, looking ahead to Sunday’s race.
"But I will give it all I can. I wasn’t able to get any more from the new tyres at the end and the Ferraris were really the quickest.
"There will be chances to do something with the strategy and I will eke out all the performance and strength I can from the car."
After another hot day, the floodlit qualifying session began with a minor drama in Q1 when New Zealander Brendon Hartley ran off track and damaged his Toro Rosso’s front wing.
Max Verstappen crashed on the exit of Turn Two, losing control as his car slewed across the track and into the barriers.
The session was red-flagged and stopped with more than five minutes to go in the session.
"I’m ok," the Dutch driver told his team, after an initial outburst that was not appropriate for a family audience. Verstappen took a pillion ride back to the pits on a scooter.
Eight minutes later, the session resumed. McLaren's Fernando Alonso squeezed into Q2 by the finest of margins, while Charles Leclerc of Sauber spun and failed to go through.
Out with him went Grosjean, Swede Marcus Ericsson in the second Sauber, Russian Sergey Sirotkin and his Williams team-mate Canadian teenager Lance Stroll.
Verstappen was unable to take part in Q2, which began with the Ferraris out early and Vettel topping Raikkonen before Hamilton, on softs, split them by taking second.
Only Bottas and Hamilton re-emerged for second flying runs, the Finn improving to take fourth while out went Hartley, Mexican Sergio Perez of Force India, Alonso, Vandoorne and Verstappen.
Both McLarens were eliminated as the Honda-powered Toro Rossos went through.
As Q3 began, Vettel set the early pace, despite running wide, before Raikkonen outpaced him with a circuit record lap in 1:28.101, just 0.095 better than the German. Hamilton took third, setting up a late flurry for pole.