Venezuelan Pastor Maldonado secured his first front row start with second place on the grid for former champions Williams.

Hamilton's pole was his third of the year but celebrations were short-lived as his team told the Briton to stop the car immediately due to an unspecified problem.

"It's a little bit of a worry," said team principal Martin Whitmarsh.

Ferrari's Fernando Alonso secured third spot for his home race, and one that has only once in 21 years been won by a driver starting off the front row, with Frenchman Romain Grosjean alongside for Lotus.

"I think it's one of the best ones I've ever had," Hamilton, runner-up last year, told reporters of his afternoon's work.

"This has always been a great place for me." Maldonado, who had rocketed to the fastest time in the second session, was delighted to shake up the order at the front with Williams first front row start since Nico Hulkenberg's surprise pole in Brazil in 2010.

"We have been working so hard trying to understand these tires and to develop our car around these tires, we did a very good step forward for this race," he said.

Red Bull's double world champion and series leader Sebastian Vettel qualified eighth without setting a lap time in the final session.

"Ultimately Sebastian didn't have great one-lap pace this afternoon, maybe it was the wind, but you have to look at it two ways," said team principal Christian Horner.

"Going into the race with four new sets of tires is an advantage. Mark has four sets of new tires and Seb has used one more set effectively so F1 is a strategic game." Vettel's Australian team mate Mark Webber's saw his hopes of a third Spanish pole in a row disappear when he failed to make the cut for the final session and qualified 12th.

That was one place behind Hamilton's British teammate and 2009 champion Jenson Button, who will also be able to change his car's setup with tires saved for the race.

"I don't know where it went wrong. All day I've struggled with balance," said Button, who had been fastest in Friday practice.

"I thought we would be reasonably competitive and at least get into Q3 (the final session) but that's not the case. I haven't changed that much but struggled with the balance." Kimi Raikkonen starts fifth for Lotus with Mexican Sergio Perez sixth for Sauber. Nico Rosberg qualified seventh for Mercedes, with team mate Michael Schumacher ninth.

At the slow end of the pack, Indian Narain Karthikeyan had his fate left in the hands of race stewards after failing to qualify for HRT with the required lap time.