At one stage it looked as though it may be even worse for the Briton after an error midway through the race allowed Kimi Raikkonen to move ahead of him.

But a decision by Hamilton’s Mercedes team to pit him for a third time saw the world champion move back ahead of Ferrari’s Raikkonen and seal the final spot on the podium.

Hamilton was hoping luck would be on his side after he qualified third – seven tenths of a second slower than Rosberg – at a street circuit where it is virtually impossible to overtake. But the Stevenage-born racer failed to make an impression on either Rosberg or Ricciardo in the opening phase of the race before a mistake on lap 33 enabled Raikkonen to pass him.

Hamilton was hampered by a brake problem which he was urged to manage by his Mercedes team from the outset of the race. But Rosberg, in the sister car, was also told to nurse a similar issue. Unlike Hamilton, it did not seem to affect his overall pace.

Indeed the 31-year-old German – despite Red Bull attempting an aggressive three-stop strategy which led to a fascinating crescendo – claimed his inaugural win at Singapore and his first podium finish here since 2008.

“Come on, guys,” Rosberg yelled over the team radio in jubilation. After leading the championship race by 43 points and then finding himself 19 behind, Rosberg is now eight points ahead with just six races remaining.

Hamilton grew increasingly frustrated as the race wore on, with a number of angry messages aimed at his Mercedes team. “Can you keep me up to date, please, I have no idea what is going on,” he said after only a handful of laps.

When Mercedes pulled Hamilton in for his first stop on the same lap as Ricciardo, the Briton – who remained behind the Red Bull – said: “Come on, guys, I needed a strategy there to get me past.”

His night got worse after he slipped behind Raikkonen following a mistake at turn 10 which enabled the Finn to pass him at the ensuing corner.

Following his second stop, Hamilton was told to move on to “Plan B”. The Briton raised his pace, and then with 16 laps left, Mercedes hauled him in for a third time.

Ferrari were caught off guard, unsure whether to leave Raikkonen out on older tyres than Hamilton or pit him to cover the world champion’s move. They opted for the latter, and it proved costly with Hamilton moving back ahead of the Ferrari.

Red Bull attempted a similar strategy to that of Hamilton with Ricciardo in an attempt to catch Rosberg. He left the pit lane 21 seconds behind the German with 14 laps to go and crossed the line only 0.4 seconds adrift. It was a fine effort from the Australian, but he fell agonisingly short.

Sebastian Vettel started last but finished an impressive fifth, one place ahead of Max Verstappen, with Fernando Alonso seventh for McLaren.

British rookie Jolyon Palmer crossed the line in 15th while Jenson Button retired with a mechanical problem.

“It has been an awesome weekend in Singapore for me,” said Rosberg, who was celebrating his 200th grand prix on Sunday. “Today I had a great start. Daniel tried to pull one up on me with the pit stop, and we knew it was going to be tight at the end, but it worked out so I am really, really happy.”

Hamilton, who remains one victory shy of his 50th in the sport, added: “A big congratulations to Nico. He drove fantastically well all weekend and fully deserved the win. This weekend has been a tricky one for me. I am still in the fight, there is still a long way to go, and I am going to give it everything I have got.”