With Mercedes teammate Lewis Hamilton finishing third, Rosberg has built an eight-point lead as he bids for his first world championship crown.
Red Bull's Ricciardo, gambling on a late pit stop for super soft tires, made massive inroads into Rosberg's lead in the closing laps, but ran out of road in the 61-lap night race, finishing just four-tenths of a second behind.
Hamilton, who started third on the grid behind the leading two, was never a factor and only a clever piece of late race strategy by his pit crew saw him overtake Ferrari's Kimi Raikkonen for the final podium spot.
Sebastian Vettel, who won the race for the fourth time last year, battled from the back of the grid to claim fifth behind his Ferrari teammate, with teenager Max Verstappen sixth for Red Bull.
It was German Rosberg's 22nd career victory in his 200th F1 race and certainly one of his hardest fought, with both Mercedes also battling brake problems on the Marina Bay street circuit, which takes a heavy toll on man and machinery.
"The whole car was on the edge, it always is in Singapore. It's all the more satisfying with a race like that," Rosberg said at the podium presentations.
He had made a good start from pole, but the race was almost immediately halted behind a safety car after an early collision between Force India's Nico Hulkenberg and Toro Rosso's Carlos Sainz.
When the safety car pulled off, a trackside marshal had a close shave -- needing to run off with the cars going full pelt.
The rest of the drama was reserved for the end of the closing stages, with Ricciardo's decision to pit for a third time for fresh tires nearly paying off.
Rosberg admitted he would have done the same as the Australian, but was caught in traffic so soldiered on with deteriorating grip and brake problems.
The latter problem also affected world champion Hamilton, who has seen his teammate win the last three races to take a solid lead with six rounds remaining.
"It's a lot different to when I was here last year but I'm still in the fight and I'm going to give it everything I've got," the Briton said.