A fourth Formula One world championship remains firmly within Lewis Hamilton’s grasp but he was given a salutary reminder of just how hard he has had to fight for it by Sebastian Vettel in qualifying for the Mexican Grand Prix. Vettel stormed to pole with an exceptional lap, while Hamilton could manage only third, with Max Verstappen putting in a remarkable lap for Red Bull to claim second place.

However the British driver needs only to finish fifth or better to claim the title on Sunday. If he does take his fourth championship he will become the most successful British racing driver, with one more than Sir Jackie Stewart.

For the large part of the season it has been a nip and tuck battle between Hamilton and Vettel, with the German leading until the 13th round at Monza. However the championship slipped from his grasp over the course of three races: two DNFs in Singapore and Japan and a fourth place in Malaysia.

In Mexico he confirmed the potential his car had shown in those races was real and that he is still able to take the fight to Mercedes, albeit it is likely to be too late. His lap for pole was reminder of just how tight the title fight might have been without that three-race swing in Hamilton’s favour.

Hamilton accepted he had simply been unable to match the pace of his competitors but remained optimistic for the race. “Pole position was the goal but just wasn’t meant to be,” he said. “It was so close in practice which is exciting and brings a lot of pressure, but this wasn’t the best qualifying session of this year.

“I think the gap is a couple of tenths more, it is is a significant gap. Their car is working better this weekend but we are still in the fight and our long-run pace is much better.

“Our race pace is good but you can’t overtake here and positioning is important but it is a long run down to turn one so we should have some fun tomorrow.”

It is Vettel’s fourth pole this year, having already secured the top spot in Russia, Hungary and Singapore and he delivered it with a consummate lap to match some of his very best. His time of 1.16.488 smashed the lap record of 1.18.704 Hamilton had set in qualifying last year. He was just eight hundredths in front of Verstappen but a full four tenths up on the British driver.

Overtaking is hard on the circuit anyway and with low tyre degradation the race will be a one-stopper making opportunities for passing even more limited. Hamilton has said he wants to claim his title with a win but may have to accept that simply staying out of trouble and taking the points he needs will be enough.

He has shown maturity and composure already this season in ensuring he avoided any potentially race-ending clashes with Verstappen in Malaysia and Vettel in the US and can be expected to do the same here.

For Vettel, however, to have any chance of staying in the fight he must win and has placed himself in the best possible position to do so with his 50th pole. “It is a big number and I am very happy with today,” he said. “Before qualifying it did not look that way, so I surprised myself. Every session has been tough, so this is very rewarding, but overall it is a great achievement. I knew if I got the first sector together I would have a better chance and I was able to build on that. When I saw how much I was up when I crossed the line, I thought it would be enough and then it was like an explosion in the car.”

The high altitude of the Mexico City track creates low drag but also low downforce making the cars tricky to set up to take advantage of the long straights but maximise performance through the tight technical sections.

Vettel had it hooked up to perfection under huge pressure from Verstappen who was also in exceptional form. But Vettel’s final run in Q3 pushed the car to the limit and in doing so put in a lap that shows just how far Ferrari have come in the latter part of the season.

Vettel needs the win but the attention will be on Hamilton. He has been going about the business of the weekend with the same composed attention to detail that has seen him win nine races this season, and six of the last eight.

It has earned him a 66-point lead over his championship rival and brought him to within a whisker of the title which, despite being off the pace in qualifying, he will still be confident of securing .

Hamilton’s team-mate Valtteri Bottas was in fourth, in front of the Ferrari of Kimi Raikkonen and the Force India of Esteban Ocon, with Daniel Ricciardo’s Red Bull in seventh. The home favourite, Sergio Pérez, finished in 10th place with the Renaults of Nico Hülkenberg and Carlos Sainz Jr in eighth and ninth respectively.

McLaren’s engine woes continued and although Fernando Alonso was in 14th he will start at the back end of the grid with his team-mate Stoffel Vandoorne, who was in 15th, after both drivers took grid penalties for replacing powerunit components. McLaren opted not to set times in Q2 for either driver.

Brendon Hartley in the Toro Rosso suffered a loss of power and had to retire in Q2 in 13th, behind the two Williams of Felipe Massa and Lance Stroll.

Sauber’s Marcus Ericsson and Pascal Wehrlein were in 16th and 17th, in front of Kevin Magnussen and Romain Grosjean in the two Haas cars and Toro Rosso’s Pierre Gasly, who did not set a time due to the team changing the engine but is allowed to race. He also has a 15-place grid penalty for replacing powerunit components.