If it hadn't been for a mistake by Leclerc on one of the last laps, Ferrari would have celebrated a second consecutive double victory – in that case for the first time since 2008.
But Briton Lando Norris, McLaren, sneaked past and took second place behind Sainz, who took his fourth career victory. Monegasque Leclerc held off fourth-placed Lewis Hamilton.
"Very fast today"
A very tough race. The first laps everyone tried to stay in the race and avoid crashes. Carlos and Ferrari were very fast today, says Norris to Viaplay.
Red Bull's reigning World Champion Max Verstappen still leads the World Championship series, but he hasn't won a GP since June.
He initially led but was passed by Sainz.
I had nothing to lose and I knew I could do it, says the Spaniard.
Verstappen didn't make it easy in his attempt to break the winless streak at Autodromo Hermanos Rodríguez.
Got time penalty
Verstappen was penalized early in the race twice for unfair driving. It gave him a 20-second time penalty. While he stood extra long in the pit, all reasonable chances of winning disappeared.
The Dutchman finished sixth and is chased in the overall standings by Norris.
Fernando Alonso, 43, was forced to retire early – and in his 400th F1 race. No one has driven more races than the Spaniard, who drives for Aston Martin. For Japanese Yuki Tsunoda, the race ended already after the start.
The next stop for the Formula 1 circus is São Paulo, already next weekend. Then three races remain.
I'll enjoy as much as possible during the four remaining races, says Carlos Sainz.