Two-time world champion Fernando Alonso staged a stunning recovery to secure an historic victory at an action-packed Singapore Grand Prix.
The Spaniard had started Formula One's first night race 15th on the grid after fuel-feed problems brought an end to his qualifying campaign in the second session on Saturday.
But the Renault driver produced a superb performance to secure his first win of the year.
Williams' Nico Rosberg finished second while McLaren's Lewis Hamilton took third to boost his lead in the drivers' standings as he looks to mastermind a first World Championship title.
Toyota's Timo Glock finished fourth while Sebastian Vettel followed up his Italian Grand Prix victory with a fifth place in his Toro Rosso.
BMW Sauber's Nick Heidfeld finished sixth, Red Bull's David Coulthard took seventh while Kazuki Nakajima of Williams finished eighth.
But the race was a disastrous one for Ferrari as Felipe Massa could only finish 13th having started the race on pole while Kimi Raikkonen suffered a crash late on.
Massa had started the race superbly, streaking ahead of Hamilton straight away, but his hopes of a podium finish came to a disappointing end on lap 18.
The Brazilian entered the pit lane but was then shown the green light while the fuel hose was still attached.
Massa injured a member of his crew as he moved away before mechanics struggled to remove the hose to allow him to rejoin the race.
Raikkonen, meanwhile, suffered heartbreak late on when he launched from the second kerb on turn 10 and was unable to recover sufficiently before ploughing into the wall.
The victory was just reward for Alonso after dominating two of the three practice sessions prior to the race.
And the 27-year-old was naturally delighted with the win.
"It was fantastic,'' he said. "I can't believe it and I think I need a couple of days to realise we have won a race."
Hamilton's third-place finish means he has a seven-point lead over Massa in the drivers' standings with three races remaining.
But the Briton refused to get carried away.
"For sure, it is all about scoring points,'' he said. "We came here with a one-point lead and Ferrari were very competitive this weekend.
"After Massa's start it had looked tough to score more points but then the race had a couple of incidents.
"We now approach the next race the same as we did this weekend and won't get ahead of ourselves.''
The lights shone brightly around the Marina Bay street circuit as Massa started well to remain at the front of the pack, while Hamilton and Raikkonen were second and third respectively by the end of the first lap.
Alonso quickly shunned any thoughts that overtaking was impossible in the race by climbing from 15th to 12th, while by the third lap Massa had built a 1.7-second lead over Hamilton.
But the safety car was deployed for the first time during lap 15 after Renault's Nelson Piquet lost control on turn 17 and crashed in spectacular fashion into a barrier.
Rubens Barrichello's Honda then had to be recovered when his car appeared to lose power.
Then followed the incredible pit scenes as Massa saw his hopes of a podium finish end when he tried to re-join the race with the fuel hose still attached to his car.
Consequently Rosberg moved into pole but he was handed a 10-second stop go penalty for entering the pit lane when it was closed and lost his lead after entering the pits to take his penalty.
Red Bull's Mark Webber became the third victim of the Singapore circuit when the Australian, having looked good for a podium finish, ran wide at turn one before making an unscheduled stop in the pits due to technical problems.
Alonso climbed into pole for the first time on lap 33 when Toyota's Jarno Trulli made his pit stop and then soon increased his lead to seven seconds.
But once again there was drama in the pits midway through the race when Coulthard had attempted to leave with the fuel hose still attached to his car. That stop cost the veteran driver as Glock and Rosberg moved up to second and third respectively by lap 44.
Massa's race continued to get worse when he spun at Turn 18 and though he had managed to recover, an unsighted Adrian Sutil slammed his Force India car into the wall when coming round the turn.
The crash once again brought out the safety car but when it left the circuit after lap 53 Alonso quickly stormed ahead before increasing his lead to six seconds three laps later.
Ferrari's hopes in the constructor standings were dealt a blow when Raikkonen crashed with just three laps to go before Alonso comfortably completed the remaining laps to secure the victory.