Britain's Cal Crutchlow was denied the first pole of his MotoGP career in a dramatic finish to qualifying for the Aragon MotoGP in Spain.
He was beaten first by Dani Pedrosa and then championship leader Jorge Lorenzo, who took pole ahead of Sunday's race.
Crutchlow had to settle for his third successive front-row start.
The Tech 3 Yamaha rider said: "I knew the others would come at the end and unfortunately I didn't get the pole position - hopefully another time."
Qualifying marked the first dry session of the week, and Lorenzo adapted best to the conditions to edge out title rival Pedrosa by 88 thousandths and claim the 23rd pole of his career with a time of one minute 49.404 seconds.
"I am happy that the bike got better each time we took it out," Lorenzo said. "We went for it on slick tires at the end and managed to get the first spot.
"Let's see what happens tomorrow."
Spaniard Pedrosa came off his bike earlier in the day, and was languishing in 19th place before a late run on his spare seemed to have secured him the number one position before his compatriot usurped him.
"It is important to be in the starting row because the first curve on this track comes very fast after the start," Pedrosa said.
Lorenzo's Yamaha team-mate Ben Spies continued his fine form from the practice sessions to claim the fourth grid slot, but it was another qualifying session to forgot for seven-time MotoGP champion Valentino Rossi as he could only guide his Ducati to eighth following a heavy crash.
Pole sitter Lorenzo is defending a 38-point lead in the championship, with only four races to go after Sunday's event.
Qualifying times for Aragon MotoGP:
1. Jorge Lorenzo (Spain) Yamaha 1:49.404
2. Dani Pedrosa (Spain) Honda 1:49.492
3. Cal Crutchlow (Britain) Yamaha 1:49.576
4. Ben Spies (USA) Yamaha 1:49.748
5. Stefan Bradl (Germany) Honda 1:50.034
6. Andrea Dovizioso (Italy) Yamaha 1:50.241
7. Jonathan Rea (Britain) Honda 1:50.410
8. Valentino Rossi (Italy) Ducati 1:50.949
9. Nicky Hayden (USA) Ducati 1:51.013
10. Hector Barbera (Spain) Ducati 1:51.072