By Alan Baldwin
BARCELONA (Reuters) - Lewis Hamilton played a qualifying ace on Saturday to seize pole position for the Spanish Grand Prix and deal another blow to championship-leading Mercedes team mate Nico Rosberg.
German Rosberg, who is four points clear of Hamilton but has been runner-up to the Briton in the last three races, qualified second with Australian Daniel Ricciardo starting third for champions Red Bull.
"When you've been on the back foot and clearly your team mate's got the upper hand but you manage to pull out an ace card just for that last lap, it's a great feeling," Hamilton told reporters after his fourth pole in five races.
Hamilton, whose pole was the 35th of his career, was 0.168 seconds quicker than Rosberg who has led the championship since the season-opener in Australia but is fast losing momentum.
"I didn't know whether I'd be able to get it but right at the end I just had to eke out absolutely everything and more from the car," said Hamilton, who could leave the Circuit de Catalunya as overall leader on Sunday night.
"To have the kind of performance we have, I have never really known that before. I'm overwhelmed, I'm so happy," added the 2008 champion, whose dominant team have taken every pole and won every race so far this year.
Ferrari's Fernando Alonso, winner in front of his home fans here last year, qualified seventh behind Finnish team mate Kimi Raikkonen in sixth.
Finland's Valtteri Bottas starts fourth for Williams, with Frenchman Romain Grosjean fifth for Lotus.
Red Bull's struggling quadruple world champion Sebastian Vettel will line up 15th on the grid after stopping on track in the final phase of the session with gearbox problems.
Although he qualified 10th, Red Bull confirmed the German would have a gearbox change for the race with a drop of five positions.
Vettel has switched to a different chassis for the start of the European season but his luck has only taken a turn for the worse.
He managed only four laps in Friday practice before being sidelined by an electrical problem and on Saturday the gremlins returned at the crucial point.
"I left the garage and lost second gear," said the 26-year-old, who has been overshadowed by new team mate Ricciardo.
"It was clear there was a problem but I still had third gear and above so I thought I'd try without second gear. But by Turn One, I'd lost all the other gears."
Ricciardo, while happy with his position on the grid, was realistic about what he could expect in the race.
"I think third is the best we can do," he said. "If Mercedes continue at the pace they had today then realistically we won't catch them."
McLaren, without a point from the last two races, also had problems with Danish rookie Kevin Magnussen unable to set a lap time in the second phase due to a power unit problem and qualifying 15th - but moving up to 14th after Vettel's grid penalty.
Magnussen's British team mate Jenson Button will start eighth.
Qualifying was twice red flagged, the second stoppage triggered by Vettel's failure and the first coming right at the start when Venezuelan Pastor Maldonado speared his Lotus into the wall.
Maldonado will be at the back of the grid, along with Toro Rosso's Jean-Eric Vergne who has a 10 place penalty after an unsafe release from the pits on Friday.
(Reporting by Alan Baldwin, editing by Justin Palmer)