McLaren's Lewis Hamilton drove a superb lap to take second place behind Red Bull's Mark Webber after a thrilling battle for German Grand Prix pole.
Red Bull's world champion Sebastian Vettel qualified outside the top two for the first time in 2011 to go third ahead of Ferrari's Fernando Alonso.
The Spaniard's team-mate Felipe Massa was fifth from Mercedes' Nico Rosberg.
McLaren's Jenson Button aborted his final run and lines up in seventh place, 1.2secs behind Hamilton.
Both McLaren drivers were downbeat about their team's chances of challenging for pole after Friday's practice at the Nurburgring but Hamilton hooked up an aggressive lap to lose out on a first pole position of the season by only 0.055 seconds.
His delight was plain over the car-to-pit radio as he made his way back to the pits. "That was a good lap," Hamilton told the team. "That was a wicked lap. That was as good as it gets."
After climbing out of the car, he added: "I definitely underestimated how good the car was with light fuel. It was one of the happiest laps I've had. It felt incredible."
BBC F1 co-commentator David Coulthard made Hamilton his driver of the day saying: "From where Lewis has come from this season he has been able to raise his game and deliver.
"He was so quick in the first sector of the lap and that was the key to his lap."
McLaren appear to have gained ground on their rivals after the teams decided to revert to pre-Silverstone engine regulations following a row over the aerodynamic use of exhaust gases.
They also had some new parts on the car, including a redesigned front wing and fins beside the driver.
Unfortunately, the improvement did not extend to Button, who was more than a second behind Webber's benchmark, and complained afterwards of a lack of rear grip.
In contrast, Webber had looked in supreme form for the past two days around the Nurburgring, where he won his first grand prix two years ago, and took pole in one minute 30.079 seconds.
"I was thinking on my in-lap, 'If someone gets me, they deserve it', as I couldn't have got much more out of it. It was my complete limit," Webber said.
The Australian was also on pole in Barcelona and Silverstone but has yet to lead a lap of a race this season, a statistic he will be desperate to erase on Sunday.
Vettel was 0.137secs behind Webber's time and begins his quest for his first victory on home soil from third.
Ferrari had been expecting to carry forward the momentum of winning the last grand prix in Silverstone but Alonso was 0.362secs off the pace and will have to rely on superior race pace and Red Bull's errors as he did in Britain.
"I don't know why you are disappointed with our performance and maybe yesterday McLaren were testing some new parts and today they are quick," said Alonso.
"We are in the position we thought yesterday. We are still improving the car.
"Rain is forecast so if that is true the race is very open. Tyre temperature will be an issue. It will be a race to survive if it's wet but we need to make sure we get on the podium."
Behind Massa and Rosberg, Force India's Adrian Sutil, Vitaly Petrov's Renault and Michael Schumacher - a five-time winner on this track - rounded out the top 10.
It's about a 1.2-second gap to Nico and all weekend we've been within a 10th. So we need to understand what's going on," said Schumacher.
"I made a mistake in my last chicane at the final lap which at least cost me eighth but if the car doesn't perform to your needs you know there's a problem."
The cool track conditions meant a host of midfield teams sacrificed a set of soft tyres to negotiate the first phase of qualifying.
While Williams and Force India fought their way through, Kamui Kobayashi stayed in the Sauber garage and the Japanese driver will have to use some of his famed swashbuckling moves as he starts in 18th.
"That's a huge blow for Sauber as they've gathered points on a consecutive basis," BBC F1 analyst Eddie Jordan said.
An exciting battle to get into the top 10 followed but Nick Heidfeld, who had spent Friday testing a new exhaust system for Renault, missed out. Force India's Paul di Resta will line up alongside him in 12th.
Karun Chandhok was given a chance to show what he could do in his first race weekend in more than a year as Team Lotus handed him Jarno Trulli's race seat in Germany.
But the Indian driver toiled during practice and Chandhok was separated from his team-mate Heikki Kovalainen by Virgin driver Timo Glock.
"I've never used DRS [moveable rear wing] or driven the car on the slick tyres so it's a lot to learn," Chandhok told BBC Sport.
"I'm sure Jarno feels terrible. It's an awful feeling watching your car driven by someone else but he'll be back for Budapest."