Sebastian Vettel claimed pole position for the Bahrain Grand Prix after pipping Ferrari teammate Kimi Raikkonen by 0.143s.

An error from Vettel put Raikkonen on provisional pole, but the German responded well with his final attacking lap to secure his 51st career pole and first since Mexico last season.

Mercedes only hope to challenge was from Valtteri Bottas, but the Finn ended up 0.166 seconds off the pace in third. Lewis Hamilton could only secure P4, which resulted in a P9 starting position following his penalty for a gearbox change.

Red Bull’s Daniel Ricciardo will move up to the second row as result, despite qualifying P5, but team-mate Max Verstappen will start further down the field in P15 after a trip to the barriers in Q3. The Dutchman got a little too greedy on the kerb and spun out on the exit of Turn 2, sliding through the gravel and going nose first into the barrier.

Verstappen had already set a time fast enough to get into Q2, but the car was too damaged to take any further part in the session.

Pierre Gasly continued his excellent showing so far this weekend by finishing best of the rest in the Toro Rosso-Honda. The Frenchman will start the race in P5 after Hamilton’s penalty and is an eyebrow-raising result considering Honda’s lack of competitiveness in recent years.

He headed Renault’s Nico Hulkenberg, separated from his team-mate Carlos Sainz in 10th by Force India’s Esteban Ocon.

Ferrari identified a small electrical fault with Vettel’s car after FP3, but he was ready to go again in time for qualifying under the lights at the Bahrain International Circuit.

It was his teammate Raikkonen who continued his good form from the weekend by taking the top spot in the first qualifying session. This was after the red flag delay generated through Verstappen’s accident and resultant clean-up, but none of the top five drivers improved in the final five minutes once the session restarted.

A tense and dramatic knockout ensued, with Fernando Alonso and Romain Grosjean both setting identical times of 1:30.530 – but because the Spaniard set his time first he ensured Grosjean stayed in the drop zone. The Haas driver was eliminated and will start P17.

Joining the Frenchman in elimination were the Sauber pair of Marcus Ericsson and Charles Leclerc, the latter spinning out on the final corner, plus Williams pairing of Sergey Sirotkin and Lance Stroll. The Grove outfit face a miserable Sunday starting from P18 and P20 respectively and seem a shadow of their former World Championship-winning selves.

Q2 most notably saw Hamilton re-emerge from the garage with soft tyres and setting his personal best on them so far. The Mercedes seems to be more comfortable on this compound in comparison to the supersofts, evidence that tyre overheating could be an issue of the W09.

McLaren became the major casualty of Q2 as both Fernando Alonso and Stoffel Vandoorne missed out the top 10 shoot-out, and also faced the fact that they were out-qualified by both Toro Rosso cars.

Brendon Hartley fell agonisingly short of reaching Q3 and will start from a still impressive P11. Sergio Perez was the other driver eliminated in P12, ahead of the McLarens, and alongside Verstappen.

In the first hot laps of Q3, Vettel ran wide at Turn 13, giving Raikkonen the opportunity to put himself on provisional pole by a whisker of 0.095s. Three-tenths covered the Ferraris, the Mercedes and Ricciardo’s Red Bull in P5 heading into the final lap showdown.

Yet Vettel was able to recover from his earlier error and took pole position by just over a tenth ahead of his 200th race start.

“It was quite intense,” Vettel said. “First run in Q3 I was very happy and then I tossed it away at the last corner. Really happy I got the second run and got it clean. The car was excellent all weekend so far.”

“The Ferrari was quicker today,” said Bottas. “We made some good progress through the weekend. We tried some things that didn’t work which is why the gap was sometimes bigger. The set-up was right. Hopefully, Lewis can come through the field.”