Frenchman Johann Zarco will start Sunday's Portuguese MotoGP in pole position on his Ducati Pramac after topping qualifying ahead of Spanish rider Joan Mir.
Aleix Espargaro was third quickest in Portimao on Saturday, while reigning world champion Fabio Quartararo will begin the fifth race of the year in fifth place.
Championship leader Enea Bastianini failed to make it through to Q2 after crashing and finished 18th.
Zarco's pole was the seventh of his career, but the twice-former Moto2 champion has never won a race in the elite category.
"I wasn't expecting such a good lap," said Zarco, who made the most of a drying track as the sun came out following rain-soaked practice sessions.
"The conditions were difficult with the puddles and we were asking ourselves which tyres to use during the last practice session.
"We were finally able to use the dry tyres for the qualifying and that worked really well."
Several of the favourites struggled to master the tricky surface, with Francesco Bagnaia appearing to injure his shoulder after a heavy tumble in Q1.
Six-time world champion Marc Marquez was in contention for pole but his lap was cancelled as Honda team-mate and compatriot Pol Espargaro crashed on the final corner.
STARTING GRID
Front row
1. Johann Zarco (Fra/Ducati-Pramac), 2. Joan Mir (ESP/Suzuki), 3. Aleix Espargaro (ESP/Aprilia)
2nd row4. Jack Miller (AUS/Ducati), 5. Fabio Quartararo (FRA/Yamaha), 6. Marco Bezzecchi (ITA/Ducati-VR46)
3rd row
7. Alex Marquez (ESP/Honda-LCR), 8. Luca Marini (ITA/Ducati-VR46), 9. Marc Marquez (ESP/Honda)
4th row
10. Pol Espargaro (ESP/Honda), 11. Miguel Oliveira (POR/KTM), 12. Brad Binder (RSA/KTM)
5th row
13. Jorge Martin (ESP/Ducati-Pramac), 14. Maverick Vinales (ESP/Aprilia), 15. Fabio di Giannatonio (ITA/Ducati-Gresini)
6th row:
16. Andrea Dovizioso (ITA/Yamaha-RNF), 17. Takaaki Nakagami (JPN/Honda-LCR), 18. Enea Bastianini (ITA/Ducati-Gresini)
7th row
19. Franco Morbidelli (ITA/Yamaha), 20. Remy Gardner (AUS/KTM-Tech3), 21: Lorenzo Savadori (ITA/Aprilia)
8th row:
22. Darryn Binder (RSA/Yamaha-RNF), 23. Alex Rins (ESP/Suzuki), 24. Raul Fernandez (ESP/KTM-Tech3)
9th row
25. Francesco Bagnaia (ITA/Ducati)