Massa on Singapore pole
Hamilton alongside championship rival on the grid
Felipe Massa will start the Singapore Grand Prix from the front of the grid after wrapping up qualification with a storming final lap.
The Brazilian's Ferrari will share the front row with Lewis Hamilton while Kim Raikkonen and the Sauber of Robert Kubica start from the second row.
Massa, who trails Hamilton by a single point in the drivers' championship, beat the McLaren driver by more than half a second under the lights at the Marina Bay street circuit.
He clocked a time of one minute, 44:519 seconds in his final lap and admitted it was a flawless performance from both driver and car.
"The car was perfect," said Massa. "I managed to do a perfect lap and that always helps when you have a good car."
Hamilton was fortunate to make the final session after only being eighth fastest in Q2, but a solid final lap set the benchmark for Massa to smash late on.
Heikki Kovalainen finished fifth in the second McLaren, which needed a new engine prior to qualifying, while Nick Heidfeld originally qualified in sixth before demoted to ninth on the grid.
The German was handed the three-place penalty for impeding Honda's Rubens Barrichello during the first qualifying session.
Heidfeld was ruled to have entered the pit lane too slowly and was consequently caught by Barrichello on a flying lap.
Monza winner Sebastian Vettel will start from sixth in the Toro Rosso with Timo Glock seventh, Nico Rosberg eighth and Kazuki Nakajima 10th.
Honda's Jenson Button, despite a promising performance in the final practice session earlier in the day, will start on 12th while David Coulthard is two places further back in his Red Bull.
However, there was bitter disappointment for Fernando Alonso, who had looked very fast in three practive sessions but must start from 15th on the grid.
The Spaniard's Renault cut out midway through the second qualifying session leaving Alonso with little alternative but to abandon the car.
"The race is lost. You can't overtake here and I'm starting from 15th, so I will be going out just to lap the track, but it's over already," he said.
01 F. Massa Ferrari 1:44.801
02 L. Hamilton McLaren 1:45.465
03 K. Räikkönen Ferrari 1:45.617
04 R. Kubica BMW 1:45.779
05 H. Kovalainen McLaren 1:45.873
06 S. Vettel Scuderia Toro Rosso 1:46.244
07 T. Glock Toyota 1:46.328
08 N. Rosberg Williams 1:46.611
09 N. Heidfeld BMW 1:45.964*
10 K. Nakajima Williams 1:47.547
11 J. Trulli Toyota 1:45.038
12 J. Button Honda 1:45.133
13 M. Webber Red Bull 1:45.212
14 D. Coulthard Red Bull 1:45.298
15 F. Alonso Renault no time
16 N. Piquet jr. Renault 1:46.037
17 S. Bourdais Scuderia Toro Rosso 1:46.389
18 R. Barrichello Honda 1:46.583
19 A. Sutil Force India F1 1:47.940
20 G. Fisichella Force India F1 no time