Marc Marquez secured pole position for the Dutch TT at Assen ahead of fellow Honda MotoGP rider Cal Crutchlow, while Valentino Rossi rebounded from a crash in FP4 to take third.
Marquez led the opening runs in Q2 aboard his works RC213V with a time of 1m33.330s, marginally quicker than his best time in third practice earlier in the day.
That time was then beaten by Jorge Lorenzo, who posted a 1m33.167s aboard his Ducati, and then again by Suzuki's Andrea Iannone on a 1m33.120s as the 15-minute shootout entered its final stages.
Running in the slipstream of Johann Zarco's Tech 3 Yamaha, Marquez logged a 1m32.791s to regain his place on top of the timesheets at the chequered flag to take only his second pole of 2018.
With many riders running together in a group for their last runs, a huge reshuffled occurred behind.
Crutchlow moved up to second on his final flyer, just 0.041s behind, while Rossi - languishing down in ninth after the first runs - vaulted to third, just a further 0.018s back.
Andrea Dovizioso was the quickest of the Ducatis in fourth place, followed by Alex Rins - who made it out of Q1 on his Suzuki - and Friday pacesetter Maverick Vinales on the second factory Yamaha.
Aleix Espargaro, another rider to crash in FP4, took a strong seventh for Aprilia ahead of Zarco, who topped Q1 ahead of Rins.
Iannone and Lorenzo were demoted to ninth and 10th places, with just 0.376s covering the top 10.
Danilo Petrucci (Pramac Ducati) and Alvaro Bautista (Nieto Ducati) completed the Q2 order.
Q1: Zarco denies Nakagami
After failing to qualify directly to Q2 for the first time this year, Zarco appeared set to be eliminated in the first qualifying segment after coming in third behind Jack Miller and Rins in the opening runs.
But a last-minute effort of 1m33.578s as the chequered flag allowed Zarco to advance, 0.022s ahead of Rins - pushing LCR's Takaaki Nakagami down from second to third at the death.
Nakagami will start from 13th on Sunday ahead of Tito Rabat (Avintia Ducati) and the second Tech 3 bike of Hafizh Syahrin, who set identical times.
Miller (Pramac Ducati) was pushed down to sixth in the closing stages, and will line up 16th ahead of Scott Redding (Aprilia) and Dani Pedrosa (Honda), who endured yet another difficult qualifying session.
KTM also had a session to forget, with Bradley Smith and Pol Espargaro set to line up 20th and 21st.