Jorge Lorenzo will begin his last MotoGP race from 16th on the grid after Fabio Quartararo pipped world champion Marc Marquez to pole position in qualifying for the Valencia Grand Prix.
Repsol Honda rider Lorenzo, a three-time world champion in the premier class, failed to make it out of Q1 on Saturday after announcing he would be retiring after this race, the last of 2019.
His team-mate Marquez, who has already sealed the riders' championship, finished just 0.032 seconds adrift of Rookie of the Year Quartararo, who claimed his sixth pole of the season.
Jack Miller, who was 0.108s behind, joins them on the front row, with Maverick Vinales, winner in Malaysia last time out, starting from fourth.
Quartararo's Petronas Yamaha team-mate Franco Morbidelli and Ducati star Andrea Dovizioso make up the remainder of the second row, with Joan Mir in seventh.
Alex Rins claimed eighth after progressing from Q1 alongside Pol Espargaro, with Johann Zarco – who is bidding to replace Lorenzo next season - missing out on the last session to finish 13th.
Cal Crutchlow was ninth ahead of Danilo Petrucci, Espargaro and Valentino Rossi.
Quartararo had previously topped the timesheets in FP1, FP2 and FP3 and will now look to end the campaign with a first race victory, but will have the relentless Marquez, who recovered from a FP4 crash, right there with him from the start.
1. Fabio Quartararo (Petronas Yamaha) 1:29.978
2. Marc Marquez (Repsol Honda) +0.032s
3. Jack Miller (Pramac Racing) +0.108s
4. Maverick Vinales (Monster Energy Yamaha) +0.200s
5. Franco Morbidelli (Petronas Yamaha) +0.471s
6. Andrea Dovizioso (Ducati) +0.533s
7. Joan Mir (Suzuki Ecstar) +0.595s
8. Alex Rins (Suzuki Ecstar) +0.617s
9. Cal Crutchlow (LCR Honda) +0.748s
10. Danilo Petrucci (Ducati) +0.793s
11. Pol Espargaro (Red Bull KTM) +0.930s
12. Valentino Rossi (Monster Energy Yamaha) +0.976s