Sandro Cortese will start from pole position for the first ever Moto3 race in Qatar.
The German, a long-time frontrunner in Moto3's 125cc predecessor series, denied pre-season title favourite Maverick Vinales (Avintia) by 0.016 seconds with his final lap on the Ajo KTM.
The pair - who had also topped all three practice sessions between them - were just two of the protagonists in an epic session-long pole battle that had also involved Alex Rins, Luis Salom, Louis Rossi, and Romano Fenati at various stages.
Rossi held pole going into the closing moments before first Vinales, then Cortese jumped ahead, but the Frenchman (ironically riding for Team Germany) held on to a front row spot.
Salom qualified fourth for RW Racing, followed by Niklas Ajo (TT Motion KTM) and Fenati - the leading world championship rookie in the field.
Zulfahmi Khairuddin showed a step forward from his 125cc form to qualify seventh for Ajo. Miguel Oliveira (Monlau), Arthur Sissis (Ajo) and Alexis Masbou (Caretta) completed the top 10.
Sometime provisional pole-holder Rins fell back to 13th in the end.
It was a disappointing session for Aspar, the team that took Nico Terol to the final 125cc title, as its riders Alberto Moncayo and Hector Faubel could only qualify 14th and 16th.