Hamilton’s last race for Mercedes was a strong one from his 16th place on the grid, where he ended up after misfortune in qualifying.
He was the only driver to start on the hard tyres and used an inverted strategy to gain places throughout a long first stint.
Rejoining from his pit stop on lap 34 of 57, Hamilton repassed Hulkenberg and Gasly, and with Verstappen already behind because of the Dutchman’s penalty, the seven-time champion was up to fifth behind Russell.
On fresher tyres, Hamilton closed on Russell and started the final lap on his tail.
Hamilton closed in down the two long straights and then used his better tyres to pass Russell around the long fast Turn Nine after the younger man defended to the inside.
That gave Hamilton a fourth place as he bowed out from 12 years at Mercedes to end the most successful team-driver combination in F1 history.
Over the team radio, Mercedes and Hamilton congratulated and expressed their admiration for each other. Hamilton said: “What started as a leap of faith turned into a journey into the history books.”
Verstappen took sixth, ahead of Gasly, Hulkenberg and Alonso, while Piastri recovered from his first-lap collision with Verstappen and a 10-second penalty for hitting the back of Franco Colapinto’s Williams to take the final point for McLaren.