Lewis Hamilton has taken the lead in the Formula One drivers' championship by winning the Singapore Grand Prix, leapfrogging teammate Nico Rosberg who had to retire early with a gear-selection failure.

Hamilton led comfortably Sunday before he was forced into a late pitstop, giving up the race lead to Red Bull's Sebastian Vettel. However, Hamilton quickly passed the German to win by 13.5 seconds at the Marina Bay circuit.

Hamilton moved to 241 points, ahead of Rosberg on 238, with five races left.

Rosberg was forced to start from the pit-lane due to an electronically-caused gear selection failure, and he did 14 laps in the stricken car before retiring.

Vettel finished second, just holding off Red Bull teammate Daniel Ricciardo.

Ferrari's Fernando Alonso was fourth.