Jorge Lorenzo captured his sixth pole position of the MotoGP season with a last-gasp, record effort in qualifying at Motegi.
The Spaniard's 1m44.969s, set as the chequered flag fell, was comfortably faster than the rest of the field, led by his main title rival Dani Pedrosa.
The Honda rider had staged his own late rally, flying to the top of the timesheets with four minutes remaining. His best, a 1m45.215s, was itself a new record before Lorenzo blazed clear.
While pole position therefore boiled down to the typical protagonists, that scenario had looked unlikely earlier on as the session came alive with 20 minutes to run.
Ben Spies was the catalyst, jumping half a second clear with a 1m45.506s, at the time comfortably the fastest lap of the weekend.
Within moments Gresini's Alvaro Bautista, Tech 3 Yamaha's Andrea Dovizioso and Honda's Casey Stoner - riding through the pain of his Indianapolis injuries - had all responded and moved into the top four.
Cal Crutchlow then made his move, posting a new best - a 1m45.275s - to take provisional pole. At that moment, Lorenzo and Pedrosa were on the fringes of the second row and doing little to threaten.
New rubber provided the boost both needed however, culminating in a thrilling climax to an unpredictable session.
There was nearly further drama when Spies, running fourth, crashed at Turn 10 just as Lorenzo began his quick lap. The marshals managed to clear his bike however and Lorenzo was unobstructed en route to his pole time.
Spies was able to hang on to fourth, just fractions behind Crutchlow.
Bautista likewise kept fifth from Dovizioso, while Stoner - who had run as high as second - was relegated to seventh late on.
That was still enough to beat LCR's Stefan Bradl, who ran through the gravel early on, and works Ducati pair Valentino Rossi and Nicky Hayden, ninth and 10th respectively.
Pos Rider Team/Bike Time Gap
1. Jorge Lorenzo Yamaha 1m44.969s
2. Dani Pedrosa Honda 1m45.215s + 0.246s
3. Cal Crutchlow Tech 3 Yamaha 1m45.257s + 0.288s
4. Ben Spies Yamaha 1m45.336s + 0.367s
5. Alvaro Bautista Gresini Honda 1m45.481s + 0.512s
6. Andrea Dovizioso Tech 3 Yamaha 1m45.612s + 0.643s
7. Casey Stoner Honda 1m45.745s + 0.776s
8. Stefan Bradl LCR Honda 1m45.848s + 0.879s
9. Valentino Rossi Ducati 1m45.976s + 1.007s
10. Nicky Hayden Ducati 1m46.461s + 1.492s
11. Katsuyuki Nakasuga Yamaha 1m46.780s + 1.811s
12. Hector Barbera Pramac Ducati 1m46.881s + 1.912s
13. Aleix Espargaro Aspar Aprilia 1m47.383s + 2.414s
14. Randy de Puniet Aspar Aprilia 1m47.581s + 2.612s
15. Karel Abraham Cardion Ducati 1m47.791s + 2.822s
16. Colin Edwards Forward Suter-BMW 1m48.125s + 3.156s
17. Yonny Hernandez Avintia FTR-Kawasaki 1m48.513s + 3.544s
18. Michele Pirro Gresini FTR-Honda 1m48.653s + 3.684s
19. Danilo Petrucci Ioda Suter-BMW 1m48.831s + 3.862s
20. James Ellison Paul Bird Aprilia 1m49.023s + 4.054s
21. Roberto Rolfo Speed Master Aprilia 1m49.183s + 4.214s
22. Ivan Silva Avintia FTR-Kawasaki 1m49.831s + 4.862s