Lewis Hamilton took pole at the Spanish Grand Prix but Ferrari's Sebastian Vettel stopped Mercedes locking out the front row in Barcelona for a fifth successive year.
Three-time world champion Hamilton clocked a time of one minute and 19.149 seconds in Q3 to bank a 64th career pole position, his first since the Chinese Grand Prix.
Despite a number of early-season upgrades there remained little to separate the two dominant constructors, but Hamilton edged out championship leader Vettel to boost his hopes of closing the 13-point gap in the drivers' standings.
Vettel came in 0.051secs behind with a small lock-up at the last chicane perhaps proving costly, but he did enough to edge Russian Grand Prix winner Valtteri Bottas (+0.224secs) out of a place on the front row
The German had cause for concern in Q1 when he was ordered to stop his Ferrari over team radio, but a change of setting enable him to keep running at full tilt.
Fernando Alonso endured a dismal Friday with McLaren's reliability issues stopping him from participating in FP1 before coming dead last in FP2, but his fortunes changed dramatically on Saturday.
The home favourite reached Q3 for the first time this season and secured seventh position, opening a chance for him to score some points before skipping the Monaco Grand Prix to take part in the Indianapolis 500.
Kimi Raikkonen took fourth ahead of Max Verstappen, the Red Bull driver proving the best of the rest at the site where he became the youngest driver to win an F1 race in 2016.
1. Lewis Hamilton (Mercedes) 1:19.149s
2. Sebastian Vettel (Ferrari) 1:19.200s
3. Valtteri Bottas (Mercedes) 1:19.373s
4. Kimi Raikkonen (Ferrari) 1:19.439s
5. Max Verstappen (Red Bull) 1:19.706s
6. Daniel Ricciardo (Red Bull) 1:20.175s
7. Fernando Alonso (McLaren) 1:21.048s
8. Sergio Perez (Force India) 1:21.070s
9. Felipe Massa (Williams) 1:21.232s
10. Esteban Ocon (Force India) 1:21.272s