Maverick Viñales shattered the all-time lap record at Valencia in Spain to grab pole at the final round of the MotoGP World Championship as title favourite Francesco Bagnaia upstaged rival Jorge Martin.
Bagnaia, who holds a 21-point lead over Martin going into Saturday's Sprint race, claimed second place on the front row after earning his spot in Qualifying 2 with a flawless performance in Q1.
The Lenovo Ducati rider was only 15th in practice on Friday but Bagnaia showed no signs that he was feeling any pressure as he strung together a sequence of impressive laps in Qualifying 1, posting his quickest time at that point in 1:29.054s to lead Gresini Ducati's Alex Marquez by 0.142s as they progressed to final qualifying.
Pramac Ducati's Martin will have to start from sixth place on the second row after a disjointed Q2 for the Spaniard, who changed bikes during the session and went out with a hard front tyre rather than a soft Michelin – a somewhat baffling decision given the cool track temperatures at the Ricardo Tormo circuit.
His Pramac team-mate Johann Zarco fired in a late fast lap to snatch third in the final seconds, denying Australian Jack Miller a front-row start, with the Red Bull KTM rider joining team-mate Brad Binder and Martin on Row 2.
After Aprilia's Aleix Espargaro initially went to the top in the decisive 15-minute session, South African Binder recorded the quickest early lap with a 1:29.171s to lead Martin, Miller and Marco Bezzecchi (VR46 Ducati) after five minutes.
Ahead of the second runs, Repsol Honda's Marc Marquez and Aleix Espargaro were jostling for position as they exited pit lane in their efforts to slot in behind Martin.
Bagnaia had the advantage of a clear track after leaving the pits on his own and took over at the top from Binder with a 1:29.167s, with Martin holding third.
Bagnaia then set the fastest ever lap at Valencia in 1:29.023s on his next lap for provisional pole with just over three minutes to go.
However, Viñales upped the ante with a blistering time of 1:28.931s to bump Bagnaia to second by 0.092s, while Miller moved onto the front row on the KTM.
In the dying moments, Frenchman Zarco grabbed third with Martin dropping to sixth in the end, while Binder will line up alongside his factory KTM team-mate Miller, who had to settle for fourth.
Marc Marquez was a faller at Turn 2 with two minutes remaining, which was the 30-year-old's 28th crash this season on the factory Honda.
Binder also went down in the closing stages while Alex Marquez was also caught out on the Gresini Ducati.
Repsol Honda's Joan Mir, who crashed in practice on Friday morning, has withdrawn from the rest of the weekend after undergoing checks in hospital.
Fabio Quartararo was only 15th on the Monster Energy Yamaha behind Augusto Fernandez (GasGas Tech 3 KTM) and Enea Bastianini (Lenovo Ducati).