Yamaha's Maverick Vinales turned around his fortunes after a tough Friday at the Austrian Grand Prix to take MotoGP pole by 0.068 seconds from Jack Miller.
Vinales admitted after Friday he was "lost" with the set-up of his YZR-M1 as the grip issues which blighted his Czech GP had carried over.
But the Spaniard was on fine form on Saturday, getting straight into Q2 in FP3 and snatching his first pole since Phillip Island last year.
Vinales set the early pace in Q2 with a 1m23.892s, engaging in a tussle for top spot with Petronas SRT's Fabio Quartararo.
The championship leader edged ahead on a 1m23.787s, with Vinales striking back with a 1m23.716s.
However, this effort was cancelled for a track limits violation, dropping him to third and elevating Quartararo back to provisional pole.
Vinales brushed this off and re-established himself at the top of the timesheets with a 1m23.694s with nine minutes remaining.
In the closing stages, Ducati's Andrea Dovizioso - who will leave the team at the end of 2020 - made himself a threat for pole.
Vinales was able to eke out a slight advantage with a 1m23.643s, before Dovizioso bettered this with a 1m23.656s.
One last attempt for Vinales allowed to him produce a 1m23.450s, which - despite Pramac's Miller's best efforts - was good enough for pole.
Quartararo trailed Miller by 0.019s, with Dovizioso demoted to the head of the second row in front of KTM's Pol Espargaro - who was left with just one bike for Q2 after a fast crash at the Rindt corner of Turn 9 in FP4.
Joan Mir completed row two on the Suzuki, with Franco Morbidelli heading row three on his SRT Yamaha ahead of Rins on the sister Suzuki and Q1 pacesetter Johann Zarco (Avintia).
Takaaki Nakagami is top Honda runner on the grid in 10th on his LCR RC213V, with Tech3's Miguel Oliveira and Q1 graduate Valentino Rossi (Yamaha) rounding out the top 12.
Ducati's Danilo Petrucci missed out on a place in Q2 by just 0.024s and was left furious at the end of the session with Aprilia's Aleix Espargaro, giving him the middle finger in the pitlane at the end of the session and punching the wall in his Ducati garage.
Espargaro - who had a crash in FP4 - had backed off late in the session at the Rindt corner and ended up getting in Petrucci's way.
The Aprilia rider was 14th in the end, with Cal Crutchlow 15th on the LCR Honda ahead of Tech3 rookie Iker Lecuona, who beat Brno race winner Brad Binder in qualifying.
The returning Michele Pirro on Francesco Bagnaia's Pramac Ducati completed the 22-rider field.
Austria MotoGP - qualifying result
Get unlimited access to the world’s best motorsport journalism with Autosport Plus