Championship contender Fabio Quartararo found speed on the last lap to take pole position for his home race at the French Moto GP on Saturday, beating Yamaha teammate Maverick Vinales and Ducati's Jack Miller.
A wet track and high humidity made conditions difficult on the 4.2-kilometer (2.6-mile) Le Mans circuit in northwestern France, which has a longest straight of 674 meters.
Quartararo clocked 1 minute, 32.6 seconds to just edge out the Spaniard Vinales in 1:32.681 and the Australian Miller in 1:32.704. It was Quartararo's second straight pole in Le Mans and 12th overall. The 22-year-old Frenchman goes for his sixth race win on Sunday.
"Before the last lap, I think I was seventh and I had nothing to lose. I made some mistakes and I told myself It's either a front row or I'll fall off,'" he told broadcaster Canal Plus.
"It's unbelievable, I'm lost for words. It's one of my best. I hope the weather is better tomorrow."
Pol Espargaro and six-time MotoGP champion Marc Marquez both had spills in free practice, with the Spanish riders coming off their bikes into Turn 3.
Italian rider Francesco Bagnaia leads the championship by two points from Quartararo after four races.
Italian Danilo Petrucci (Ducati) won last year's French GP.