Franco Morbidelli snared a first ever MotoGP pole position at the Catalan Grand Prix as Fabio Quartararo stole a march on disappointing title rival Andrea Dovizioso.
Quartararo appeared set to head the pack at the Circuit de Barcelona-Catalunya having set the fastest lap with just under two minutes to go.
But Petronas Yamaha team-mate Morbidelli set a blistering time of one minute and 38.798 seconds on his final flying lap to bump Quartararo down to second.
Yamaha locked out the front row as the legendary Valentino Rossi (Monster Energy Yamaha), who it was confirmed on Saturday will take a Petronas seat in 2021, qualified third.
It was a poor outing for championship leader Dovizioso, though, who failed to make it into the final qualifying session and will start way back on the sixth row in 17th.
The Ducati rider will need a huge performance in Sunday's race to keep hold of his championship lead, with Quartararo and Maverick Vinales just a point back.
Jack Miller (Pramac Ducati) made it through Q1 and impressively qualified fourth, with Vinales (Monster Energy Yamaha) and Johann Zarco (Avintia) completing the second row.
Pol Espargaro (Red Bull KTM Factory Racing), Joan Mir (Suzuki Ecstar) and Danilo Petrucci (Ducati) are on the third row.
1. Franco Morbidelli (Petronas Yamaha) +1:38.798s
2. Fabio Quartararo (Petronas Yamaha) +0.210s
3. Valentino Rossi (Monster Energy Yamaha) +0.331s
4. Jack Miller (Pramac Ducati) +0.427s
5. Maverick Vinales (Monster Energy Yamaha) +0.573s
6. Johann Zarco (Avintia) +0.580s
7. Pol Espargaro (Red Bull KTM Factory Racing) +0.697s
8. Joan Mir (Suzuki Ecstar) +0.830s
9. Danilo Petrucci (Ducati) +0.843s
10. Brad Binder (Red Bull KTM Factory Racing) +0.861s
11. Takaaki Nakagami (LCR Honda) +0.915s
12. Miguel Oliveira (Red Bull KTM Tech 3) +1.390s