Daniel Ricciardo pipped Red Bull team-mate Max Verstappen to pole position at the Mexican Grand Prix, with Lewis Hamilton third.
Ricciardo prevented Verstappen from becoming the youngest pole winner in Formula 1 history with a lap out of the blue right at the end of the session.
The Australian was just 0.026secs quicker than Verstappen, who had dominated the weekend up to that point.
Hamilton can win a fifth world title if he finishes the race at least seventh.
Hamilton in prime position
The Mercedes driver will also be champion if Vettel fails to win the race, which looks highly likely given the imperious form shown by Red Bull so far in Mexico City.
The German qualified fourth, 0.211secs off the pace and 0.076s adrift of Hamilton.
The second Mercedes of Valtteri Bottas was fifth, ahead of Ferrari’s Kimi Raikkonen, and the Renaults of Nico Hulkenberg and Carlos Sainz best of the group of midfield teams.
Hamilton, though, was thrilled to be so high up after Mercedes struggled badly in the hotter conditions of Friday practice, when he was only seventh fastest.
“Really, really happy with it,” he said. “We had a difficult day yesterday and it was a big improvement today. It was a real struggle but the team did a great job analysing and moving forward, that was as good as I could get.”
If he has a clean race, it is hard to see how the Briton cannot clinch the title from that starting position.
However, history provides a salutary lesson – Hamilton also started third in Mexico last year, with Verstappen also second, and the Mercedes driver suffered a puncture in a third-corner clash with Vettel, who had been on pole, and could finish only ninth.
At that time, that was enough for him to secure the championship, but it would not be on Sunday if Vettel can find a way to beat the Red Bulls.
Ricciardo back on top
Ricciardo shouted and whopped in delight in his helmet when he was told he had taken pole, the first time he had out-qualified Verstappen since the Monaco Grand Prix in May.
“I knew it was there somewhere,” he said. “We hadn’t had the cleanest run through practice but I knew the pace was in the car; Max showed that through the weekend. So it was just a matter of putting together a clean lap.”
It was only the third pole of his career, the first two being at Monaco, and the first time Red Bull have had a one-two on the grid since the advent of turbo hybrid engines in 2014.
Verstappen, who had topped all three practice sessions and second qualifying, was furious to miss out, blaming engine problems.
He said: “The whole qualifying was crap. Problems since P2, engine braking not like I wanted, just rear locking. I tried to make the best of it. I thought it was going to be enough but we see what happens tomorrow.”
Why are Red Bull suddenly so dominant?
But Ricciardo and Verstappen will go into the race as hot favourites for victory on a track where their car has excelled all weekend.
The high altitude reduces the power deficit of their Renault engine and also forces all teams to run their cars with their maximum downforce set-ups, of which Red Bull has the best in the pit lane.
The team, though, will be concerned about avoiding any clash between their drivers – the two crashed out when disputing a position in Baku.
And the pressure to win on both will be high – especially Ricciardo, who is leaving the team to join Renault for 2019.
Vettel, who said he had a messy final lap, added: “The Red Bulls are very fast. They will be hard to beat. Maybe they beat themselves.”