Lewis Hamilton surprised himself by beating Sebastian Vettel to pole position at the Hungarian Grand Prix.
Hamilton was 0.038 seconds faster than the Red Bull driver and after being told over the radio, he said: "Is that pole?" and whooped with delight.
The Mercedes man was 0.332secs faster than team-mate Nico Rosberg, who was fourth behind Lotus's Romain Grosjean.
Vettel's title rivals, Ferrari's Fernando Alonso and Lotus's Kimi Raikkonen, will start fifth and sixth.
Grosjean suffered a scare when the floor of his car failed a mandatory stress test after qualifying.
But he was allowed to keep his position because there was evidence he hit a kerb during second qualifying, damaging the floor stay, which meant the floor flexed more than it would normally do in the test.
Apart from the damaged stay, Grosjean's floor was identical to that on Raikkonen's car, so the stewards concluded it was a case of accidental damage rather than non-compliance.
Ferrari's Felipe Massa was seventh, ahead of Toro Rosso's Daniel Ricciardo, McLaren's Sergio Perez and Red Bull's Mark Webber, who did not take part in the top 10 shoot-out because of a failure of his Kers power-boost system and his seamless gearshift.
Vettel had looked the form man all weekend and set a blistering pace early in the top 10 shoot-out.
But Hamilton produced another stunning qualifying lap to take his third consecutive pole position.
His qualifying record against Rosberg this season is now seven-three in Hamilton's favour.
"I was really surprised to get pole," Hamilton said. "I was expecting Sebastian to get it and it didn't even feel that great a lap. We've brought some upgrades this weekend and the guys have been working incredibly hard."
Vettel said: "There wasn't much missing, so Lewis did a good job, put a strong lap in.
"I was pretty happy with both laps. I was losing out a little in the middle sector; maybe I wasn't aggressive enough. But in the end I was happy with my lap but it was just not quick enough.
"Lewis did a good job as you can see from the gap to Nico, you have to respect that."
Grosjean has been the faster Lotus driver all weekend but did not quite have the pace to compete with Hamilton and Vettel.
Alonso said: "It was a little miracle today to be fifth. It's a track that has been historically not so good for Ferrari with these slow-speed corners, need for traction.
"And to be a little bit closer to the pole position is good news, especially after the 10th on the grid in Silverstone, eighth in Nurburgring."
Perez's team-mate Jenson Button was 0.232secs slower than the Mexican and failed to make it into the top 10 shoot-out, qualifying 13th, behind Force India's Adrian Sutil and Sauber's Nico Hulkenberg.
Scot Paul Di Resta failed to make it past the first knock-out session and will line up 18th. "Where did the grip go?" he asked his engineer over the team radio.