Repsol Honda star Marc Marquez claimed pole position for Sunday's Australian MotoGP with his last lap in a thrilling qualifying session.
After rain lashed the Phillip Island circuit on Saturday morning, second qualifying took place in sunny and dry conditions, which allowed the world championship leader to post the fastest time of the weekend in the dying seconds.
Top local hope Jack Miller will start on the second row of the grid after qualifying fifth on his Marc VDS Honda — equalling the career-best MotoGP start he achieved at Phillip Island last year.
Marquez's main world title rival, Ducati Team's Andrea Dovizioso, will start in 11th place, while nine-time world champion Valentino Rossi will start from seventh on his Movistar Yamaha.
Rossi had to battle his way into the second qualifying session after struggling through Friday's two practice sessions.
Under MotoGP rules, the top 10 riders from the first three practice sessions advance to second qualifying on Saturday afternoon where they fight it out for pole position.
The rest of the field go into first qualifying with the top two riders there advancing into second qualifying where the first 12 spots on the starting grid for Sunday's race are decided.
Bradley Smith (Red Bull KTM Factory Racing) was the other rider to advance from the first qualifying session with Rossi and he will start from ninth.
Rossi's factory Yamaha teammate, Maverick Vinales, overcame a high-speed crash on Friday to qualify second, with Johann Zarco (Monster Yamaha Tech 3) completing the front row in third.
Former world champion Jorge Lorenzo suffered a sprained ankle in a crash on Saturday morning and will start from 16th on his factory Ducati.
Broc Parkes, the only other Australian on the grid, will start from 21st on the Monster Yamaha Tech 3 he is riding for the unwell Jonas Folger.
Australia's Remy Gardner (Tech 3 Racing) will start from 16th on the Moto2 grid, with Italian Mattia Pasini (Italtrans Racing Team) claiming pole.
In Moto3, Jorge Martin (Del Conca Grisini) scored his eighth pole position of the season, while Australian wildcard Tom Toparis will start from last place (31st) on the grid for Cube Racing.