Charles Leclerc swept to pole position for the Mexico City Formula One Grand Prix on Saturday with Carlos Sainz qualifying second in a surprise Ferrari front-row lockout.
The Italian team had seemed slow in final practice, with Leclerc 13th and Sainz 15th, but they pulled the time out of the hat when it mattered, with Leclerc lapping in one minute 17.166 seconds.
Sainz was 0.067 slower with triple world champion Max Verstappen, chasing a 51st career win and record 16th of the season, third on the grid for Red Bull and 0.097 off the pace.
Australian Daniel Ricciardo qualified a stunning fourth for AlphaTauri after returning from a broken hand.
Red Bull's Sergio Perez qualified fifth for his home race, with Mercedes' Lewis Hamilton sixth after being fastest in the second phase.
"I did not expect to be on pole position today because we were lacking quite a bit after FP3," said Leclerc, who has now secured 22 poles in his F1 career but only had five wins.
"For some reason once we put everything together it went well, the new tyres we gained a lot."
Sainz, the only driver to beat the dominant Red Bulls this season with victory in Singapore, was also stunned to be on the front row.
"It was a very strange one... I just struggle to understand where suddenly we can find half a second and then go half a second slower in the next lap," said the Spaniard.
Verstappen was fastest initially in the final phase before Sainz went faster and then Leclerc put himself on provisional pole.
The final flying laps did not change the order and the Monegasque could celebrate his second pole in a row, after Austin last weekend.
"I am confident for tomorrow. Of course I would like to start first but we will have a good slipstream down to Turn One," said Verstappen, who was cleared by a stewards' investigation of possibly impeding in the pit lane.
BOTH TITLES
Verstappen and Red Bull have won both championships, but the Dutch driver is chasing records and a fifth win in Mexico in the last six races there.
McLaren's Oscar Piastri qualified seventh with Mercedes' George Russell eighth and Alfa Romeo's Valtteri Bottas and Guanyu Zhou ninth and 10th respectively.
Williams' Alex Albon, second fastest in final practice, thought he had made it through to the top 10, but stewards deleted his fastest lap for exceeding track limits and reinstated Zhou.
McLaren's Lando Norris, expected to be a contender for the front row after three second places in the last four races, caused the first big shock when he was knocked out in the opening phase.
The Briton will start in 18th place, with Williams' U.S. rookie Logan Sargeant behind him and AlphaTauri's Yuki Tsunoda demoted to last of all due to power unit penalties.
"I got told to box for some reason, the pace was good," Norris said of his initial effort on medium tyres. "I got told to box. So something obviously wasn't right. But that wasn't a problem.
"I just made some mistakes on my one lap that I had, obviously there was a yellow (flag thrown) in the end from Fernando (Alonso) so that one opportunity, that one lap I was given I didn't put together and that was it."
Spaniard Alonso spun his Aston Martin towards the end of the first phase, with the ensuing yellow warning flag forcing others to slow.