Vettel, who started third on the grid, crossed the finish line 2.641 seconds ahead of Charles Leclerc — who was unhappy with team pit strategy — in a Ferrari 1-2.
It was four-time F1 champion Vettel's first win since the 2018 Belgian Grand Prix.
"Obviously the start of the season has been difficult for us but in recent weeks we started to come alive," Vettel said. "It's been incredible to get so much support from the fans and I tried to put it all into the track today and into the car and I'm glad it paid off."
With six races remaining, Hamilton holds a 65-point lead over Mercedes teammate Valtteri Bottas, who finished fifth. The winner of each race gets 25 points.
It was Vettel's fifth victory under the lights in Singapore and ended a 22-race winless streak.
Leclerc started from pole and held the lead at the 3.1-mile (5-kilometer) Marina Bay street circuit until he pitted on the 21st lap of the night race. When Leclerc rejoined, he was behind Vettel, who had pitted a lap earlier.
Leclerc made it clear over the team radio that he was not happy that Vettel pitted first and got the lead.
Vettel said he received the call from his team to pit and it wasn't his decision.
"It was a very late call," Vettel said. "I thought it was a bit early because I wasn't sure we can make the tires last in the second stint but, yeah, then I just gave it everything in the outlap because I saw the two cars in front of me not pitting, especially Lewis. I was then very surprised a lap later to come out ahead."
Leclerc, who won the previous two races and appeared set for a third straight victory, was diplomatic later when asked about the pit strategy of Ferrari.
"It's always difficult to lose a win like that but in the end it's a 1-2 for the team," Leclerc said. "We arrived here hoping for a podium and come back with a 1-2 so are extremely happy."
During the race, Leclerc had a different take when he was told to save his engine 15 laps from the finish. His response to Ferrari included: "I just don't think it's fair, but I won't do anything stupid."
Red Bull's Alexander Albon was in sixth place and Lando Norris finished seventh for McLaren, ahead of Toro Rosso's Pierre Gasly.