The pole, in a rain-affected session at Interlagos, was a record-extending 82nd of Hamilton’s career and his 10th of a season that has already seen the Briton clinch his fifth world championship.

Mercedes will seal the constructors’ title on Sunday unless Ferrari outscore them by 13 points.

Hamilton’s team mate Valtteri Bottas, who was on pole in Brazil last year, qualified third with Ferrari’s Kimi Raikkonen fourth on an all-Finnish second row.

“That was a tough qualifying session,” gasped a delighted Hamilton, who had never previously managed to take a pole in a season after winning the title with races to spare.

“The weather was going up and down and we didn’t really know what to expect. Obviously Ferrari are incredibly quick this weekend.

“I didn’t know whether or not I had the pole. The last lap wasn’t that great, if I’m honest. I had a bit of understeer in a few places,” added the Briton, who has five stars and the late Brazilian Ayrton Senna’s design on his helmet.

He was the only one to improve on his final flying lap, after earlier securing provisional pole, with a best time of one minute 07.281 seconds — a track record and more than a second quicker than last year’s pole.

Related Coverage

Hamilton and Vettel provided the main talking points of the session, with the former fortunate to escape the immediate attention of the stewards after nearly colliding with the Williams of Russian Sergey Sirotkin in the second phase.

Raikkonen also had to swerve to avoid him in another incident.

Vettel’s summons by the stewards was inevitable after he was called in for weighing at a critical point in the second phase with rain threatening, making it crucial to get in an early timed lap.

With a cone barring access to the weighbridge, he drove into it and then gesticulated angrily for officials to hurry up, before driving off again in a breach of the regulations.

The governing FIA said that by keeping the engine running he had made it hard to get a stable result and by driving off rather than being pushed he had also ‘destroyed’ their equipment.

“They shouldn’t call us when the conditions are changing like that, I think it’s unfair if somebody gets pulled in. I wanted them to hurry up,” said Vettel.

Stewards handed the four-time world champion a reprimand for failing to follow instructions, his first of the season, and a 25,000 euros (£21,838) fine.

Before the summons, it looked like Ferrari had pulled off a tactical masterstroke as the only team into the final phase on soft tyres, rather than the faster but quicker-wearing super-soft, giving them a potential advantage at the race start.

Slideshow (11 Images)

Red Bull’s Max Verstappen qualified fifth with Australian team mate Daniel Ricciardo sixth but dropping five places due to a penalty for having a turbocharger replaced.

That will lift Sauber pairing Marcus Ericsson and Ferrari-bound Charles Leclerc to sixth and seventh, the latter producing a phenomenal lap to get into the final phase in tricky conditions with time running out.