The defending three-time world champion dominated the session and delivered a best lap in one minute and 18.704 seconds, two-tenths of a second clear of championship leader Rosberg who salvaged a front row starting spot with the last lap of the top-ten shootout action.
Hamilton's success brought him his 10th pole position of the season and the 59th of his career.
"It's always so tough trying to pull out the perfect laps when it matters," said a relieved Hamilton. "Definitely, for me, very challenging."
If the German wins on Sunday and Hamilton scores just one point or fewer then Rosberg will be world champion for the first time.
Dutchman Max Verstappen looked sure to take second until Rosberg's final fastest effort and he wound up third for Red Bull ahead of his team-mate Australian Daniel Ricciardo.
"It's the front row and I am glad of that," said Rosberg. "I'm not on pole, but I have a chance from there. I don't know why I have struggled to tune in the car, but I am there now. It was a brilliant lap by Lewis. I put it together when it counted."
Nico Hulkenberg also delivered a spectacular late lap to take fifth place for Force India ahead of Kimi Raikkonen and four-time champion Sebastian Vettel of Ferrari.
Valtteri Bottas was eighth ahead of his Williams team-mate Felipe Massa and Carlos Sainz who was 10th for Toro Rosso.
On a bright, but cool day at the Autodrom Hermanos Rodriguez, Briton Jolyon Palmer was ruled out of qualifying shortly before it began because Renault had discovered a crack in his chassis.
When the action started, Hamilton was one of the first of the leading men into the fray for Q1. He was soon fastest before Vettel and Raikkonen clocked quicker times with their early laps, but responded to top the pack.
Disclaimer: No Business Standard Journalist was involved in creation of this content
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
