Italy's Bastianini snatches pole position ahead of Portugal MotoGP
The 26-year-old clocked 1min 37.706sec on the Portimao circuit to finish 0.082sec ahead of Maverick Vinales of Aprilia whose fellow Spaniard Jorge Martin was third best at 0.106 for Ducati.
"I'm very satisfied. Since Friday, we've seen that the bike has potential for this weekend," said Bastianini, who suffered a fractured shoulder in a heavy fall in Portugal last year.
"It's my first pole with Ducati so it's fantastic, and it makes me really happy after the disaster of the last year here.
"I'm confident because I think we can still improve before the sprint."
On the hilly Algarve circuit, the rider nicknamed 'La Bestia' (The Beast) outshone his teammate and compatriot Francesco Bagnaia, the world championship leader after his victory at the season-opening race in Qatar.
The reigning double world champion will start on the second row after setting the fourth best time ahead of the Australian Jack Miller (KTM) and Italy's Marco Bezzecchi (Ducati-VR46).
Impressive Spanish rookie Pedro Acosta (Gasgas-Tech3) took seventh place.
The 19-year-old bettered six-time Spanish world champion Marc Marquez (Ducati-Gresini) and Frenchman Fabio Quartararo (Yamaha).
The sprint race starts later Saturday at 1600 GMT with the weekend's main event at 1400 GMT on Sunday.