Yamaha rider Maverick Vinales took pole for MotoGP's San Marino Grand Prix after topping an intense final qualifying session at Misano in which Marc Marquez crashed.
Marquez had been the man to beat for much of the Misano weekend so far, and while he had to abort his first two hot laps in Q2, the Honda rider surged to the top of the times on his third attempt with a 1m32.636s.
Vinales, Yamaha's only factory rider this weekend in Valentino Rossi's absence, slotted into second, just 0.016s behind, the pair more than four tenths clear of the rest of the pack at the halfway point.
Ducati's Jorge Lorenzo managed to close that gap to just over a tenth when he went third at the start of his second run, but teammate and points leader Andrea Dovizioso knocked Marquez off the top spot when he posted a 1m32.616s with less than two minutes left on the clock.
Marquez looked set to retake provisional pole on his final lap, only to lose the front-end of his works RC213V at the fast Turn 13 right-hander and crash out, escaping injury.
Vinales, on the other hand, managed to eclipse Dovizioso's time by 0.173s on his last run with a 1m32.439s, enough to give him his fourth career MotoGP pole and his first since Mugello.
Marquez was forced to be content with a slot on the front row behind Dovizioso, the Italian impoving on his final run to finish 0.162s down on Vinales.
LCR Honda rider Cal Crutchlow heads the second row after narrowly beating Lorenzo to fourth, with Tech 3 Yamaha's Johann Zarco completing the top half-dozen.
Last year's Misano winner Dani Pedrosa could do no more than seventh, ahead of Pramac Ducati's Danilo Petrucci and the leading Aprilia of Aleix Espargaro.
Completing the top 10 was Q1 pacesetter Alvaro Bautista (Aspar Ducati), ahead of Ducati wildcard Michele Pirro and the second Aspar machine of Karel Abraham.
Folger and Miller get times scrapped
While it was Aspar duo Bautista and Abraham who progressed out of Q1, the two fastest times were set by Tech 3 Yamaha's Jonas Folger and Marc VDS Honda man Jack Miller.
Miller had grabbed the top spot off Bautista with a 1m33.548s, but this was deleted as the Australian exceeded track limits at Turn 11.
Moments later, Folger improved to a 1m33.287s to provisionally top the session, but he too was caught out by track limits, running wide at the final corner.
It means Miller and Folger will start 14th and 16th on the grid respectively for Sunday's race, with Avintia Ducati duo Hector Barbera and Loris Baz moving up to 13th and 15th places.
Pol Espargaro was KTM's top qualifier in 17th, despite a late crash at Turn 2, while Suzuki had to make do with 20th and 21st for Alex Rins and Andrea Iannone, who both lost laps to track limits violations.
Aprilia's Sam Lowes lines up 23rd and last after crashing early in the session at Turn 16.
|4||Cal Crutchlow||LCR Honda||Honda||1m32.768s||0.329s|
|6||Johann Zarco||Tech3 Yamaha||Yamaha||1m32.885s||0.446s|
|8||Danilo Petrucci||Pramac Ducati||Ducati||1m32.997s||0.558s|
|10||Alvaro Bautista||Aspar Ducati||Ducati||1m33.417s||0.978s|
|12||Karel Abraham||Aspar Ducati||Ducati||1m34.374s||1.935s|
|13||Hector Barbera||Avintia Ducati||Ducati||1m33.920s||1.481s|
|14||Jack Miller||MVDS Honda||Honda||1m33.933s||1.494s|
|15||Loris Baz||Avintia Ducati||Ducati||1m33.946s||1.507s|
|16||Jonas Folger||Tech3 Yamaha||Yamaha||1m33.987s||1.548s|
|18||Tito Rabat||MVDS Honda||Honda||1m34.095s||1.656s|
|19||Scott Redding||Pramac Ducati||Ducati||1m34.132s||1.693s|