Spain's Fernando Alonso ended a year-long win drought to take the Singapore Grand Prix, winning a drama-filled first ever night race as a comical error cost Felipe Massa dearly.
It was the Renault driver's first victory since the Italian Grand Prix last year and capped a remarkable weekend that saw him top two of the free practice sessions but start 15th on the grid after a mechanical problem in qualifying.
He claimed his 20th career triumph by 2.95 seconds over Germany's Nico Rosberg in a Williams and Britain's world championship leader Lewis Hamilton in third.
Toyota driver Timo Glock was fourth with Toro Rosso's Sebastian Vettel following up his win in Italy this month with fifth. BMW Sauber's Nick Heidfeld took sixth.
The race was a new experience for every driver on a street circuit under powerful spotlights and it turned out to be one of the most exciting of the season.
Despite dark clouds lurking, Singapore's notorious tropical downpours stayed away and the whole race was run in dry, but hot and humid conditions.
Ferrari's Massa started from pole but a disastrous mistake cost him the race and valuable points in his push for the world title.
His 13th place finish means he is now seven points behind Hamilton in the championship hunt with just three Grand Prix left at Japan, China and Brazil.
The Brazilian was in the pits on lap 15 when he was given the green light and drove off with the fuel hose still attached to his car, leaving one of the pit crew floored and subsequently carted off in a neck brace.
Massa ended up sitting in his Ferrari at the end of the pit lane as the crew ran after him and managed to pull the hose free, but it ruined his chances. He was given a drive-through penalty and rejoined in 18th place.
It was a miserable night for Ferrari with defending world champion Kimi Raikkonen ramming his car into the barriers with just four laps to go, ending his race.
The Massa drama occurred after the cars came in when Nelson Piquet careered into the wall on the exit from turn 17, bouncing into the barriers on the other side of the track, causing massive damage to his Renault.
He climbed out unscathed but the safety car was deployed.
Massa was leading at the time with Hamilton second but at the restart, Rosberg was in front followed by Jarno Trulli and Giancarlo Fisichella, with Robert Kubica fourth and Alonso fifth.
Hamilton was ninth, but Rosberg and Kubica were subsequently slapped with a ten-second stop penalty for coming into the pits after the Piquet crash before it had opened.
The complicated scenario saw Toyota's Trulli in the lead on lap 28 but without having pitted with Alonso second, Rosberg third and Hamilton charging in sixth.
With Trulli taking his first pit stop soon after Alonso, who started from 15th on the grid, amazingly found himself in front just after the halfway mark with a 4.9 second lead over Rosberg.
Alonso came in for his second pit stop on lap 41 and came out still in the lead, marginally ahead of David Coulthard and Hamilton.
Remarkably, when Coulthard pitted soon after he too drove off with the fuel pipe attached, knocking over a mechanic who was stretchered off with an injured ankle, dropping the Scotsman to ninth.
There was more action to come.
Alonso was cruising with a 23-second lead when Adrian Sutil shunted his Force India into the wall, bringing the safety car out again and wiping out the Spaniard's advantage.
When they restarted with seven laps left it was a sprint to the finish and two-time world champion Alonso made no mistake, writing his name in the record books as the first winner of a Formula One night race.