The 32-year-old Briton, who would have needed to finish in the top five to be sure of the title if Vettel had won the race, battled from last position in his Mercedes after suffering a puncture that needed an opening lap pit-stop as Dutchman Max Verstappen won the race for Red Bull.
Vettel, already a four-time champion, came home fourth for Ferrari after driving through the field from 19th following his part in the early crash with Hamilton. He also pitted for a new front wing.
Hamilton’s title triumph made him the first Briton to be a four-time champion, elevating him clear of Jackie Stewart, and alongside Vettel and Frenchman Alain Prost.
Only German Michael Schumacher with seven titles and Argentine Juan-Manuel Fangio on five have claimed more championships than the Englishman.
“I don’t know what happened at turn three, I gave him plenty of room,” said Hamilton.
“It doesn’t feel real man. It’s not the race you want when you’re 40 seconds down, but I never gave up.”
After five wins in the previous six races, it was a disappointing way for Hamilton -– who said he wanted to win the title in style –- to win the crown.
Verstappen won the race convincingly ahead of Hamilton’s Mercedes team-mate Valtteri Bottas and his Finnish compatriot Kimi Raikkonen of Ferrari.
“I’d like to say a big thanks to everybody in this Mercedes team,” said Hamilton. “What you’ve done the past couple of years is incredible. I’m so grateful.”
– ‘Start was crucial’ –
Vettel finished fourth ahead of Frenchman Esteban Ocon of Force India, Williams’ Canadian rookie Lance Stroll on his 19th birthday, and local Mexican hero Sergio Perez in the second Force India.
Dane Kevin Magnussen finished eighth for Haas ahead of Hamilton and two-time champion Fernando Alonso, who battled hard to resist Hamilton before finishing 10th for McLaren.
Verstappen led from the first lap once Hamilton and Vettel had clashed.
“The start was very crucial, I went around the outside and from then on I was just looking after the car and the tyres,” said the Dutchman after a third race win.
“Big thanks to Red Bull, without them it was not possible. After last week (when he received a five-second penalty in Austin which lost him third place), it was a perfect race.”
Mercedes’ non-executive director Niki Lauda, a three-time world champion, hailed Hamilton’s achievement.
“Lewis won it, he deserves it,” said Lauda who said Vettel was at fault for the opening lap collision.
“I don’t know why Sebastian drove so aggressively to destroy his race. Lewis was in front and Vettel hit him with his front wing, I just don’t understand it.”
The race was run in near-perfect conditions at the Autodromo Hermanos Rodriguez, with an air temperature of 21 degrees Celsius and the track at 24, Vettel making a decent start from his 50th pole position.
But with a long 890-metre straight run to Turn One, both Verstappen and Hamilton made attacks, the Dutchman fighting his way round the outside to snatch the lead.
– ‘Deliberate?’ –
Hamilton followed him and as he passed Vettel, the pair collided, the German’s Ferrari running into Hamilton’s rear right wheel and causing a puncture amid a flurry of flying debris.
Both had to limp back to the pits where Vettel took a new front wing and Hamilton, slower to complete the lap, took a new set of tyres.
They rejoined in 19th and 20th places with the Englishman a long distance from the field ahead.
“Simply, simply lovely,” said a delighted Verstappen on his Red Bull team radio as he pulled out a comfortable advantage ahead of Bottas.
“Did he hit me deliberately?” asked Hamilton. “Not sure, Lewis,” came the reply.
As a result of that collision, Hamilton’s hopes of taking the title with a win were severely deflated, but not those of being champion – Vettel needing to win, or finish second, to keep his challenge alive.
Remarkably, for Hamilton, he was lapped for the first time since the 2013 Spanish Grand Prix before he and Vettel began to pass their way through the field to set up a tense closing period.
Knowing Vettel was unlikely to climb to second, Hamilton knew he would be champion, but he fought hard to score points and took ninth place with a battling pass of Alonso in the closing laps.
Download our app and read this and other great stories on the move. Available for Android and iOS.