Renault's Fernando Alonso claimed a shock pole for Sunday's Hungarian Grand Prix after a qualifying session delayed by a Felipe Massa crash.

Sebastian Vettel, of Red Bull, qualified second fastest on Saturday afternoon, with his team-mate Mark Webber third.

McLaren's Lewis Hamilton could not quite match his practice performances, but he still managed a season's best fourth position, with fellow Briton Jenson Button eighth for Brawn.

Williams's Nico Rosberg was fifth, with Heikki Kovalainen sixth and Kimi Raikkonen seventh.

Confusion reigned at the end of the session with the timing screens at the Hungaroring going black towards the end of the top-10 shootout.

After several minutes, it finally came through that Alonso had taken his first pole since the Italian Grand Prix in 2007, and the 18th of his career.

Explaining the chaos at the end, Alonso said: "We were chatting amongst ourselves in parc ferme trying to find out what happened.

"It was a fantastic effort from the team. We put in some new parts at the Nurburging (German Grand Prix), and we've showed we have made a step forward.''

The session was delayed when Massa crashed into a tyre wall and the Brazilian was later airlifted to hospital after being knocked unconscious.

Massa ran over a piece of debris on track towards the close of the middle 15-minute session that had been deposited earlier by Rubens Barrichello's Brawn GP.

After being taken to the circuit's medical centre in what the FIA described as "a stable condition", Massa was then flown to a city hospital for further examination 22 minutes after his shunt.

Behind eight-placed Button are Williams' Kazuki Nakajima, with Massa 10th as he naturally took no part in the closing 10 minutes, however, he will be in a position to race on Sunday.

In the 15-minute Q2, the biggest loser was Rubens Barrichello, with the Brazilian failing to make it into the top 10 for the first time this season due to the part that broke off his car.

The 37-year-old will start a miserable 13th, with that failure potentially wrecking his championship chances, which could now prompt Brawn into putting all their eggs into Button's basket.

Either side of Barrichello are the Toyotas of Jarno Trulli in 12th and Timo Glock 14th, while Toro Rosso's Sebastien Buemi will start 11th and Renault's Nelson Piquet 15th.

After being given a reprieve by Renault, as the race in Germany was expected to be the Brazilian's last, Piquet's F1 career is poised to draw to a close.

Given equal equipment for this race with team-mate Alonso, Piquet finished half-a-second adrift of the double world champion in Q2.

Although rookie Jaime Alguersuari became the youngest to take part in a Formula One qualifying session, there was no fairytale for the 19-year-old.

Alguersuari had run faultlessly through three practice sessions, at least proving he was anything but 'a danger' as suggested by triple world champion Niki Lauda.

In qualifying, however, Alguersuari was undermined by an electrical fault that forced him to pull his Toro Rosso off track in the final sector.

Come the conclusion of the 20-minute period, Alguersuari sat at the bottom of the timesheets, in many respects where he was expected to finish even if his car had not let him down.

However, he finished just 0.4secs shy of Robert Kubica as there was no respite for the wretched form of the BMW Saubers, with team-mate Nick Heidfeld also ditched in Q1 as he will start 16th.

Sandwiched in between in 17th and 18th are Force India's Giancarlo Fisichella and Adrian Sutil, the latter only just managing to set a time.

Sutil's car spent the majority of the session in the garage as his mechanics attempted manfully to make repairs after a crash in final practice in which he buried the nose of his car in a tyre wall.