Tech3 KTM's Miguel Oliveira took his maiden MotoGP pole position on home soil by 0.044 seconds for the Portuguese Grand Prix, as world champion Joan Mir qualified 20th.
MotoGP hasn't visited Portugal since 2012, but caps off its 2020 season with its very first Portuguese rider taking pole at the series' first visit to the Algarve International Circuit in a thrilling final Q2 of the year.
Avintia's Johann Zarco set the benchmark with a 1m39.938s, though this was immediately bested by fellow Frenchman Fabio Quartararo on the Petronas SRT Yamaha.
Quartararo's 1m39.877s stood for all of 20 seconds, when factory Yamaha counterpart Maverick Vinales edged ahead with a 1m39.689s.
Fellow Yamaha rider Franco Morbidelli just scraped through Q1 and shot to the top of the order with a 1m39.245s on a medium rear tyre.
Morbidelli's effort went unchallenged until the final three minutes, when the Italian on his year-old SRT machine produced a 1m39.141s on his sole soft tyre for the session.
The SRT rider dipped underneath the 1m39s barrier with a 1m38.936s on his final lap, with Q1 pacesetter Cal Crutchlow on the LCR Honda and the factory team RC213V of Stefan Bradl provisionally joining him on the front row.
But several improvements late on pushed the Hondas off the front row, with Oliveira lighting up the timing screen on his final lap.
The Tech3 rider hooked up his final sector to best Morbidelli for pole with a 1m38.892s, with Pramac's Jack Miller completing the front row.
Crutchlow's LCR swansong will begin from fourth on the grid ahead of Quartararo and Bradl, with Zarco shuffled back to seventh after a late crash at Turn 8.
Vinales ended up 0.368s off the pole time down in eighth, with KTM's Pol Espargaro unable to advance on ninth after a fast start to his final lap.
Alex Rins was the leading Suzuki rider in 10th and in need of a big recovery on Sunday on his quest for runner-up spot in the championship, with the Spaniard heading Takaaki Nakagami - who crashed in FP4 - on the LCR Honda and Andrea Dovizioso for his final Ducati outing.
KTM's Brad Binder put Morbidelli's passage into Q2 under threat over his final two laps, but missed out by 0.114s and will start 13th ahead of Aleix Espargaro (Aprilia) and Pramac's Francesco Bagnaia.
The biggest shock of qualifying came in the form of the world champion Mir failing to get out of Q1 and starting an equal-career worst 20th on his Suzuki having had a lap cancelled late on.
Mir only has Avintia's Tito Rabat on his MotoGP farewell and Tech3 stand-in Mika Kallio behind him, with Honda's Alex Marquez, Valentino Rossi on his final factory Yamaha appearance, outgoing Ducati rider Danilo Petrucci and Lorenzo Savadori (Aprilia) filling slots 16 to 19.
MotoGP Portuguese GP qualifying results
Get unlimited access to the world’s best motorsport journalism with Autosport Plus