LCR Honda rider Cal Crutchlow broke MotoGP's Jerez track record to take pole position for the Spanish Grand Prix.
Crutchlow was fastest by 0.259s in an otherwise ultra-close session, where second and ninth was separated by 0.130s.
Ending his first run after just one lap, Crutchlow quickly jumped on his second bike and completed his second run during the mid-session pitstops.
He took the lead with 1m37.752 at that time, demoting factory Honda rider Marc Marquez from the lead.
While that time was not beaten for the rest of the session, Crutchlow improved again after the chequered flag fell to take his fourth MotoGP pole position with a 1m37.653s.
Fellow Honda rider Dani Pedrosa and Johann Zarco jumped into second and third with their late flyers to share the front row with Crutchlow.
Jorge Lorenzo settled for fourth, with Marquez only taking fifth.
The Spaniard was the early pace-setter in the session and, despite going fastest in the first two sectors of the track on three occasions, he failed to improve every time.
Marquez beat Suzuki duo Alex Rins and Andrea Iannone by seven and 10 thousandths of a second.
The Ducati GP18s of Andrea Dovizioso and Danilo Petrucci took eighth and ninth respectively despite both being less than half a second off the pace.
It was a disappointing qualifying for Yamaha factory duo Valentino Rossi and Maverick Vinales as they were 10th and 11th, only managing to beat Pramac Ducati's Jack Miller.
Q1: Dovizioso easily first, Vinales narrowly second
Dovizioso and Vinales, the two biggest names taking part in Q1, had successfully advanced to the second part of qualifying after missing out on an automatic spot in FP3.
The factory Ducati rider set a time of 1m38.402s on the only flyer of his first run, something the rest of the field couldn't match before the mid-session pitstops.
Dovizioso was the first one to rejoin the track for his second run, and again only did one lap, his 1m38.074s enough to secure first place.
Fellow Ducati rider Tito Rabat was second, 0.002s ahead of Vinales, after the first runs, but the latter edged three tenths ahead after the pitstops.
Rabat then crashed at Turn 1 shortly after his flyer and Aleix Espargaro took his place as Vinales' main challenger for the Q2 spot.
However, a last-second effort from the Aprilia rider fell 0.040s short.
Behind Espargaro, Honda rookies Takaaki Nakagami (LCR) and Franco Morbidelli (Marc VDS) will start 14th and 15th with Pol Espargaro leading KTM's efforts in 16th.
Rabat had to settle for 17th.