Lewis Hamilton grabbed pole position for the 2013 Formula 1 Hungarian Grand Prix with a dramatic last-gasp lap at the Hungaroring. The Mercedes driver, who struggled through all three free practice sessions, produced a sensational 1:19.388 to beat Sebastian Vettel of Red Bull to the top of the grid.

READ: Formula 1 Hungarian GP 2013: Where to Watch Race Live and Weather Updates

Mark Webber [Red Bull Racing-Renault]

Vettel's time of 1:19.426 was only marginally slower though, suggesting the world champion remains a potent threat to Hamilton and a hot favourite to take the chequered flag in Sunday's race.

Lotus-Renault's Romain Grosjean finished third in qualifying with 1:19.595, cementing a solid weekend so far. He beat Hamilton's team mate, Nico Rosberg, to the front of the second row of the grid; the German posted 1:19.720.

Ferrari occupy fifth and seventh on the grid, with double world champion Fernando Alonso posting 1:19.791 and Felipe Massa managing 1:19.929. The two are either side of a former Ferrari driver, Kimi Raikkonen; the Finn, Grosjean's team mate, posted 1:19.851.

Toro Rosso's Daniel Ricciardo and McLaren's Sergio Perez are eighth and ninth, with Vettel's team-mate Mark Webber a disappointing 10th. It is believed the Australian struggled with an electronics problem through qualifying. And, worse still, he lost the KERS systems at the start of Q2.

Other major disappointments were the Force India-Mercedes pair of Adrian Sutil and Paul di Resta. Sutil will be particularly disappointed, after having run in the top ten all through practice. Perez's team mate, Jenson Button, will start 13th, as the McLaren continues to struggle for any meaningful pace.

Caterham F1 had a good session though, with Charles Pic and Giedo van der Garde out-qualifying the Marussia pair of Jules Bianchi and Max Chilton.

READ: Formula 1 Hungarian GP 2013 Preview

READ: Formula 1 Hungarian GP 2013: Vettel and Webber Control Pace at Hungaroring

READ: Formula 1 Hungarian GP 2013: Vettel and Webber Keep Red Bull on Top