Vettel refused to let teammate Charles Leclerc back into the lead after drafting past him and Hamilton at the start, but eventually retired from the grand prix following an engine failure.
Leclerc had got himself back ahead of Vettel and into the net lead of the race by this point by stopping early, but Vettel parked his car on track and caused a virtual safety car.
That allowed Hamilton and his Mercedes teammate Valtteri Bottas to make their pitstops during the caution period, which they converted into an unexpected one-two finish as Leclerc finished a frustrated third.
Vettel got a mega run from third place at the start, passing Hamilton almost immediately and then drafting Leclerc on the run to Turn 2, taking the place.
The race was immediately neutralised under a safety car because of a three-car clash involving Romain Grosjean, Daniel Ricciardo and Antonio Giovinazzi.
Giovinazzi found himself between both cars under braking for Turn 4, made contact with Ricciardo on the inside and pitched the Renault into Grosjean, whose Haas speared into the barriers on the outside.
As the Haas was recovered, it emerged that Ferrari had ordered Leclerc not to fight Vettel if Vettel used the tow to get ahead at the start, and agreed to swap the drivers back when racing resumed.
However, one week after Leclerc was angered by Ferrari’s strategy handing Vettel the win in Singapore, Vettel defied an instruction to let Leclerc past, and then proceeded to pull away from his disgruntled teammate.
Leclerc was the first of the leaders to pit, and used his four laps on fresh mediums to set a searing pace that meant he moved ahead of Vettel when the race leader stopped on lap 22 of 53.
Shortly after rejoining the track, Vettel suffered an apparent MGU-K failure, and crawled to a halt.
That caused a VSC and was a double whammy for Ferrari, as Hamilton and Bottas had stayed out and Leclerc was still well outside the Mercedes drivers’ pitstop window in the event of a caution.
Hamilton and Bottas duly pitted as Leclerc circulated at considerably reduced speed, changing to soft tyres and rejoining first and third.
George Russell then suffered a bizarre crash under the VSC, thanks to an unspecified failure, which turned it into a full safety car period.
Ferrari opted to sacrifice Leclerc’s track position to switch him from mediums to softs, dropping him to third behind Bottas but eliminating Mercedes’ tyre advantage in terms of age and compound.
However, despite Leclerc’s best efforts, he was unable to mount a serious attack on Bottas at any point after the restart.
That left Hamilton in the clear to take his 82nd victory in F1 in unexpected circumstances and extend his championship leader over Bottas to 72 points with five races remaining.
Max Verstappen finished fourth after a quiet race. The Red Bull driver had started ninth after a five-place grid penalty and lost touch with the leaders as he worked his way through to fifth early on.
He used the VSC to switch to mediums and ran to the finish a few seconds adrift of Leclerc.
Verstappen’s Red Bull teammate Alex Albon finished fifth despite starting from the pitlane and rising from the tail of the top 10 during the final stint.
He demoted Carlos Sainz to sixth during that ascension, denying Sainz a top-five finish for McLaren – although the Spaniard still earned best-of-the-rest honours after heading the midfield battle all afternoon.
He received a five-second penalty for leaving the track at Turn 2 during his unsuccessful defence of seventh from Perez.
The second McLaren of Lando Norris was the sole beneficiary, moving up to eighth, as Renault’s Nico Hulkenberg dropped too far back to also move ahead of Magnussen and thus finished 10th.
Robert Kubica was the only other retirement. His Williams team ended his race shortly after Russell’s crash “to conserve parts”.