In a calamitous few laps for Ferrari, the Italian team threw away a possible one-two finish of its own after Sebastian Vettel broke down and Charles Leclerc dropped from first to third.
Valtteri Bottas followed teammate Hamilton home at the Sochi Autodrome as Mercedes secured the full quota of points.
Hamilton now leads Bottas in the championship by 73 points. Leclerc is 107 points behind the British driver.
"What an effort, guys," said a jubilant Hamilton on the radio after the race. "What an incredible job. That is exactly what we needed. We never give up."
Ferrari had already got themselves into a needless mess before Vettel retired with an engine failure on lap 28.
Vettel got the jump on pole-sitter Leclerc on the long drag down to the second corner but a curious pre-race arrangement had Leclerc calling for the roles to be reversed.
It appears that the team had agreed that if Vettel benefited from Leclerc's slipstream and moved ahead of the Frenchman off the start line, he would have to concede the position.
Ferrari were on the radio to tell Vettel to let Leclerc by, but the four-time world champion resisted the order.
Leclerc protested over the radio.
"You put me behind and I respected everything," he said. "We will talk later."
The Ferrari pit wall were on to Vettel again, but again the German refused to let his teammate pass, fearing that he would be exposed to Hamilton in third place if he slowed down.
Leclerc was the first to stop on lap 22, but instead of calling in Vettel the next time around Vettel was left on old tires as his teammate put in several fast laps on his fresh tires.
Four laps after Leclerc pitted, Vettel was eventually called in and by the time he emerged he had fallen behind his teammate and into second place.
Just moments later disaster struck as Vettel broke down with an engine failure.
It was then to get worse for the Scuderia. With Vettel's broken down machine in a precarious position, the virtual safety car was deployed to slow down the field, allowing Hamilton, who had yet to pit, a free stop for tires and the lead of the race.
George Russell then crashed out in his Williams and the full safety car was deployed. Ferrari decided to pit Leclerc and put him on new tires for the remaining 20 laps.
But their decision saw him lose a position to Bottas, and on a track where overtaking is difficult, Leclerc was unable to pass the Mercedes driver.
Hamilton crossed the line 3.8 seconds clear of his teammate to claim his ninth win of the season and end Ferrari's three-race winning streak.
"It is incredible to have this result considering how quick (Ferrari) were off the start," said Hamilton. "To keep up with them was an incredibly hard task."
Reflecting on his probable sixth title, the Mercedes driver added: "I try not to think about the championship and take it one race at a time.
"We don't want to stumble. It feels like a long time coming, but the first time, too, so that is why this win is special."
Leclerc, meanwhile, declined to blame the team or his teammate for the mid-race drama.
"I will always trust the team but the tactic was me giving the slipstream and for us to be one-two, which happened, but then I don't know.
"I need to speak to the team to know the situation better."