The McLaren driver has a seven-point lead over Ferrari's Felipe Massa with three races remaining.
Massa led early on but finished 13th after a delay when he left the pits with his fuel hose still attached.
Alonso ended a season's frustration when a safety car period tallied perfectly with his team's strategy.
The double world champion had been quick all weekend but qualified only 15th when a fuel pump problem stopped him taking part in the second session.
Renault put him on a short first stint and he climbed up to 11th before an early stop on lap 12.
That meant that when the safety car came out after Alonso's Renault team-mate Nelson Piquet Jr crashed on lap 15, the Spaniard was alone in not having to stop for fuel and tyres.
I need a couple of days to realise that we could win a race this year, we have been so far from the top guys
Fernando Alonso
Once everyone had stopped, Alonso was fifth behind Williams's Nico Rosberg, Toyota's Jarno Trulli, Force India's Giancarlo Fisichella and BMW Sauber's Robert Kubica.
But Rosberg and Kubica had to serve stop-go penalties for pitting while the pit lane was closed during the safety car period.
Trulli and Fisichella were on single-stop strategies but Alonso had more than enough pace to ensure he made enough of a gap to ensure he could make a second stop and stay ahead of them.
It was his first win since last year's Italian Grand Prix, when he was driving for McLaren, a team he left after one season following a tumultuous season as Hamilton's team-mate.
A second intervention by the safety car closed the field up for the last 10 laps but Alonso was always in control and he finished ahead of Rosberg and Hamilton.
Alonso said: "Fantastic. The first podium of the season and the first victory.
"I can't believe it right now, I need a couple of days to realise that we could win a race this year, we have been so far from the top guys.
Massa's race - and possibly his title hopes - were wrecked by an error
"We were unlucky in qualifying yesterday but lucky in the race. The safety car really helped me today.
"We chose to do a very aggressive first stint because we knew starting 15th you couldn't overtake.
"We thought about doing a one-stop strategy but we had some concern over the brakes and we knew a one-stop was not possible. But the pace was there. All through the race were able to pull a gap on the guys behind us. The pace was super today."
Toyota's Timo Glock was fourth ahead of Toro Rosso's Sebastian Vettel, BMW Sauber's Nick Heidfeld, Red Bull's David Coulthard and Williams's Kazuki Nakajima.
Ferrari's Kimi Raikkonen crashed out coming out at the notorious Turn 10 chicane on lap 57 while running fifth.
The first safety car intervention defined the race in more ways than Alonso's victory.
606: DEBATE
I have to say please can Ferrari do that every weekend it was hilarious
SportsAddict2000
Massa had looked set to dominate, leading away from pole position and pulling away from Hamilton in the early stages of the race.
But when Massa stopped for fuel and tyres under the safety car, he was given a green light to leave the pits from Ferrari's pit equipment before the refuelling hose had been detached.
The Brazilian pulled away, knocked over a mechanic, and tore the refuelling hose away from the equipment.
He had to stop at the end of the pit lane and wait for his mechanics to sprint down and remove it before he could rejoin the race at the back.
Massa's afternoon was then made even worse when he was given a drive-through penalty for leaving his pit dangerously.
Hamilton dropped back behind the Red Bulls of Mark Webber and David Coulthard when most of the field stopped during the safety car period.
But the gearbox on Webber's car failed and Hamilton passed Coulthard just before his final stop on lap 42.
That left the Englishman third behind Alonso and Rosberg when a second safety car period following an accident to Force India's Adrian Sutil on lap 51 closed the field right up.
Alonso's 20-second lead was reduced to nothing, but he got a jump on Rosberg as the race re-started and pulled away again to secure the win.
Hamilton tracked Rosberg to the finish but, with the championship at stake and Massa not scoring, preferred not to take any risks in pursuit of an extra couple of points and secure the six for third place.
Hamilton had plenty to celebrate after finishing third
"I enjoyed driving here and I'm pretty happy," Hamilton said. "It was a tough weekend but we got some good points."
The first safety car period was as unlucky for Rosberg as it was lucky for Alonso - he was forced to come in when the pit lane was closed because it was the lap for his scheduled first stop and he would have run out of fuel had he stayed out.
But he was able to run long enough after the re-start to establish enough of a lead before serving his penalty to lose a place only to Alonso.
"When I saw the safety car coming out on the lap I was due to pit, I was like: 'This is not possible - it's every single time'," Rosberg said.
"I was really annoyed until I was able to pull a big enough gap afterwards."
Result of Singapore Grand Prix:
1 Fernando Alonso (Spa) Renault one hour 57 minutes 16.304 seconds2 Nico Rosberg (Ger) Williams-Toyota 2.9 seconds behind3 Lewis Hamilton (GB) McLaren-Mercedes +5.9secs