Lewis Hamilton kept his slim championship hopes alive by claiming pole position for Sunday's Mexican Grand Prix ahead of his title rival Nico Rosberg.
Rosberg, 26 points ahead of Hamilton in the title race, arrived here in Mexico knowing that a win tomorrow, and 10th or lower for Hamilton, would be enough for him to clinch the championship.
But the German, who has been strangely out of sorts this weekend, was staring at a disappointing fourth on the grid only to save his very best lap of the weekend until the closing moments to join Hamilton on the front row.
The Red Bull duo of Max Verstappen and Daniel Ricciardo will start from third and fourth respectively.
With the championship race reaching its final crescendo, Rosberg, a winner in Mexico last year, has been well off the pace of Hamilton throughout the weekend.
Hamilton was comfortably faster than the German in all three practice sessions, and while his 10th pole of the season rarely looked in doubt, it appeared as though Red Bull would throw a spanner in the title works.
Hamilton can win each of the three remaining races, and still miss out on the championship. Indeed Rosberg can afford to finish second on two occasions, and third once, to claim his maiden title.
And at one stage Rosberg was on course to start behind not only Hamilton, but Verstappen and Ricciardo, too, before he pulled out his fastest lap to pip the Red Bull pairing. While Rosberg, who was 0.2 seconds slower than Hamilton, he will be relieved to join his Mercedes team-mate on the front row.
Aside from the championship battle, Jolyon Palmer, the British rookie who is bidding to prove to his Renault bosses he deserves a second season with the team, will start from the back of the field tomorrow after he was ruled out of qualifying with a cracked chassis.
Renault discovered the problem after final practice on Saturday morning, but they were unable to resolve the issue in time for qualifying.
"I won't be taking part in quali after we found a crack in the chassis," Palmer tweeted. "Big shame as we were 14th in FP3 and aiming for Q2 again."
His team-mate Kevin Magnussen qualified 14th, one place behind Jenson Button was 13th for McLaren. The 2009 world champion, who will bring to an end his run of 17 consecutive seasons in Abu Dhabi next month, was four tenths adrift of his team-mate Fernando Alonso, who qualified 11th.
Elsewhere, Nico Hulkenberg was fifth for Force India, while the Ferrari pair of Kimi Raikkonen and Sebastian Vettel, who threatened to take the challenge to Mercedes this weekend, a disappointing sixth and seventh.