Jenson Button beat Sebastian Vettel and Rubens Barrichello to pole position for the Spanish Grand Prix with a stunning late lap.
The championship leader had appeared to be struggling to match his Brawn teammate Barrichello's pace for most of the build-up, and fell as low as eighth as others completed their final runs in Q3. But Button crossed the line to start his last lap just as the checkered flag fell, and proceeded to snatch pole away from Vettel (Red Bull) by 0.133 second.
Barrichello briefly held provisional pole before Button and Vettel improved, leaving the Brazilian third.
Felipe Massa showed Ferrari's best form of the year to take fourth after being fastest in morning practice and Q1. That made up for his teammate Kimi Raikkonen's disastrous session. The Finn had a poor first Q1 lap -- 0.8sec slower than teammate Massa's session-topping effort -- but still felt safe enough not to go for a second run. That proved complacent, for he was then pushed down to 16th and out of qualifying.
Mark Webber put the second Red Bull fifth on the grid, with late gains from Toyota's Timo Glock and Jarno Trulli pushing home crowd favorite down Fernando Alonso down to eighth for Renault.
Friday pace-setter Nico Rosberg was correct in his prediction that he would not challenge for pole. The Williams driver was only ninth, ahead of BMW's Robert Kubica.
Nelson Piquet had his best qualifying performance of the year and was on course for a top-10 start until the final seconds of Q2, when other drivers' improvements edged the Renault drivers back to 12th, between Kazuki Nakajima (Williams) and Nick Heidfeld's repaired BMW Sauber.
McLaren fell back after its promising Bahrain weekend. Lewis Hamilton could only manage 14th, while Heikki Kovalainen fared worse still and was only quick enough for 18th position.
Sebastien Buemi again outperformed his Toro Rosso teammate Sebastien Bourdais as they took 15th and 17th on the grid, and the Force Indias remained on the back row, Adrian Sutil half a second quicker than Giancarlo Fisichella this time.
Pos Driver Team Q1 Q2 Q3
1. Button Brawn-Mercedes (B) 1:20.707 1:20.192 1:20.527
2. Vettel Red Bull-Renault (B) 1:20.715 1:20.220 1:20.660
3. Barrichello Brawn-Mercedes (B) 1:20.808 1:19.954 1:20.762
4. Massa Ferrari (B) 1:20.484 1:20.149 1:20.934
5. Webber Red Bull-Renault (B) 1:20.689 1:20.007 1:21.049
6. Glock Toyota (B) 1:20.877 1:20.107 1:21.247
7. Trulli Toyota (B) 1:21.189 1:20.420 1:21.254
8. Alonso Renault (B) 1:21.186 1:20.509 1:21.392
9. Rosberg Williams-Toyota (B) 1:20.745 1:20.256 1:22.558
10. Kubica BMW-Sauber (B) 1:20.931 1:20.408 1:22.685
11. Nakajima Williams-Toyota (B) 1:20.818 1:20.531
12. Piquet Renault (B) 1:21.128 1:20.604
13. Heidfeld BMW-Sauber (B) 1:21.095 1:20.676
14. Hamilton McLaren-Mercedes (B) 1:20.991 1:20.805
15. Buemi Toro Rosso-Ferrari (B) 1:21.033 1:21.067
16. Raikkonen Ferrari (B) 1:21.291
17. Bourdais Toro Rosso-Ferrari (B) 1:21.300
18. Kovalainen McLaren-Mercedes (B) 1:21.675
19. Sutil Force India-Mercedes (B) 1:21.742
20. Fisichella Force India-Mercedes (B) 1:22.204
All Timing Unofficial