Petronas SRT rider Fabio Quartararo will start Sunday's Catalan Grand Prix from pole position after beating Marc Marquez by just 0.015s.
Quartararo has looked competitive all weekend and admitted he was surprised by his own pace given his recent arm surgery, but that didn't seem to hinder him at all as he posted a best time of 1:39.484 to go quickest.
Quartararo's team-mate Franco Morbidelli looked like the one to beat early on in the session as he dominated Q1 before topping Q2, before Maverick Vinales pipped him by just 0.001s to take provisional pole.
But it was Quartararo who would go on to improve and take the top spot, with Marquez having to settle for second after suffering a big moment at Turn 4 as he pushed the absolute limit.
That dropped Vinales down to third and secured him his first front-row start since Argentina. Morbidelli was fourth, heading up row two, ahead of the factory Yamaha of Valentino Rossi to make it four Yamaha's inside the top five.
A late flyer from Andrea Dovizioso moved the Ducati rider up to sixth ahead of team-mate Danilo Petrucci, who crashed out at Turn 5.
Alex Rins also crashed out of the session after falling at Turn 10, which ended his session prematurely, but he had set a time good enough for eighth before the incident.
Cal Cruthclow, Jorge Lorenzo, Joan Mir and Pol Esparagaro completed the Q2 runners.
Pramac Ducati's Jack Miller was another to crash out on Saturday, taking a tumble in Q1. He was able to get going again and improved on his previous time to go 14th, just missing out on progressing as he came up short of Francesco Bagnaia.