Daniel Ricciardo upstaged his Red Bull team-mate Max Verstappen with a dazzling record lap to snatch pole position in the final seconds of Saturday's thrilling shootout for the Mexican Grand Prix, with Lewis Hamilton taking third.
After seeing his young Dutch team-mate dominate every practice session, the Renault-bound Australian produced a stunning riposte in one minute and 14.759 seconds, beating Verstappen by 0.026, as Red Bull swept the front row of the grid.
It is Ricciardo's third career pole and the team's first lockout since the United States Grand Prix in 2013.
World championship leader Hamilton, seeking to clinch his fifth drivers' title, was third for Mercedes ahead of rival Sebastian Vettel of Ferrari with Valtteri Bottas fifth in the second Mercedes and Kimi Raikkonen sixth in the second Ferrari.
German Nico Hulkenberg was seventh ahead of his Renault team-mate Carlos Sainz and the two Saubers of Charles Leclerc and Marcus Ericsson.
Verstappen was hoping to become the youngest pole-sitter in F1 history and was clearly disappointed.
"Thanks, legends," shouted a wildly happy Ricciardo over team radio before adding later: "I knew it was in there somewhere -- I just knew the pace was in the car -- Max showed that all weekend.
"I still wasn't convinced it was the cleanest lap, but I've got to relax a little -- I'm tripping major nut-sack right now... Shout out to the team to get a one-two."
A glum Verstappen could not hide his feelings. "The whole qualifying was crap," he said.
"I had the same problems as I had in FP2 -- engine braking not what I wanted, rear locking... I thought it would be enough with the problems we had."
Hamilton, who will be champion again if he outscores Vettel by five points, or if the German fails to win, was satisfied with third.
"I am really happy with it," he said. "We had a difficult day yesterday and it was a big improvement. I wasn't expecting to get as high as we got.
"Being behind the Red Bulls is not a bad thing -- third is a nice place to start here as you get a good tow from the buys ahead." Vettel said: "I think we got more or less everything out of the car, but dropping to fourth from second is not satisfying."
Out went Romain Grosjean and his Haas team-mate Kevin Magnussen in Q1 with Stoffel Vandoorne of McLaren and both Williams cars again. It was Haas' first double exit from Q1 since the same race in 2017.
In Q2, Verstappen regained the initiative with a record lap in 1:15.640 ahead of Hamilton while out went the Force India's of Esteban Ocon and local hero Sergio Perez, either side of Fernando Alonso's McLaren, along with the two Toro Rossos.
Qualifying results: Daniel Ricciardo (Australia, Red Bull) 1:14.759, 1; Max Verstappen (Netherlands, Red Bull) 1:14.785, 2; Lewis Hamilton (Great Britain, Mercedes) 1:14.894, 3; Sebastian Vettel (Germany, Ferrari) 1:14.970, 4; Valtteri Bottas (Finland, Mercedes) 1:15.160, 5; Kimi Raikkonen (Finland, Ferrari) 1:15.330, 6; Nico Hulkenberg (Germany, Renault) 1:15.827, 7. C. Sainz Jr (Spain, Renault) 1:16.084, 8; C Leclerc (Monaco, Sauber) 1:16.189, 9. M Ericsson (Sweden, Sauber) 1:16.513, 10.