SINGAPORE- Lewis Hamilton snatched a dramatic last-gasp pole position from his Mercedes team-mate and championship leader Nico Rosberg for Sunday's Singapore Grand Prix with a phenomenal lap in the final seconds of Saturday's qualifying session. The 29-year-old Briton left it late, crossing the line after three rivals had in succession cut their times to take provisional pole to the raucous delight of the crowd as he secured the prime starting position by just 0.007 seconds.

Rosberg, who leads him by 22 points in the drivers' championship with six races remaining, will start alongside him from second place after the Mercedes pairing grabbed their team's seventh one-two of the year. It was Hamilton's third pole success in Singapore, his sixth this season and the 37th of his career. Rosberg's reaction was pithy, but understandable when he was given the news on team radio: "Dammit!"

Mercedes F1 boss Niki Lauda said: "Unbelievable! They did a good job my two guys, but everyone's catching up, that worries me a little bit." Australian Daniel Ricciardo, whose lap appeared to be enough for pole, delighted many of his compatriots packed into the Marina Bay street circuit by claiming third on the grid for Red Bull ahead of his team-mate and defending four-time champion Sebastian Vettel, winner of the last three Singapore races.

Behind the two Red Bulls, Fernando Alonso qualifying fifth for Ferrari ahead of Felipe Massa of Williams and Kimi Raikkonen, who was seventh in the second Ferrari. On a tense and thrilling evening, Finn Valtteri Bottas was eighth in the second Williams ahead of Danish rookie Kevin Magnussen of McLaren and Daniil Kvyat for Toro Rosso.

In hot conditions with a humidity level of 77 per cent at the start, the opening Q1 mini-session was busy from the start as Hamilton and Alonso set the early pace under the 1,500 spot-lamps that flooded the Marina Bay circuit with light for the seventh running of a modern classic street race.

Hamilton, one of only three drivers - all champions -- to have won in Singapore, clocked a best early lap in 1:47.847 to set the pace while the other two victors Alonso and Vettel, who is chasing a fourth successive win, adopted alternative strategies.

Alonso was soon on the pace, but Vettel delayed until the final minutes when Ricciardo and Hulkenberg also took advantage of the improving track conditions as the cars laid down a layer of rubber with their super-soft tyres. By the end, Ferrari were on top with Raikkonen ahead of Alonso and Hamilton third ahead of Button, an outcome that suggested Mercedes' mastery was under threat. It was the first time this year that the Finn was fastest.

A late effort saved Massa from joining the usual suspects in early elimination as Adrian Sutil of Sauber, Pastor Maldonado of Lotus, Jules Bianchi and his Marussia team-mate Max Chilton went out with the Caterham pairing. In Q2, Alonso and then Hamilton set the pace again as Ferrari continued to flex their new-found muscle before a late Rosberg lap lifted him top by nearly half a second.

Jenson Button missed out on the top ten shootout, finishing 11th for McLaren ahead of job-hunting Jean-Eric Vergne of Toro Rosso, the two Force Indias, Esteban Gutierrez of Sauber and Romain Grosjean, who was 16th in his Renault. For Button, it signalled that he had been out-qualified 8-6 by Magnussen this year while for Grosjean, a front-runner last year, frustration boiled over. "I cannot believe it, bloody engine, bloody engine," he complained.