Marc Marquez earned his fourth consecutive MotoGP pole position of the season by breaking the lap record at the Lusail International Circuit.
Marquez snatched pole away from younger brother Alex Marquez with the final lap of the session, as he continued his perfect qualifying streak.
The Spanish rider set the pace early on in the session but was still just outside challenging the all-time lap record held by World Champion Jorge Martin.
Bagnaia had been heavily favoured to challenge Marquez throughout the weekend but crashed with less than five minutes remaining which meant the Italian would start from the third row at best.
The session was drawn to a nail-biting end as Fabio Quartararo put his Yamaha on provisional pole, which was taken away moments later by Gresini’s Marquez.
However, with the final lap of the session, the eight-time World Champion benefited from a slipstream from Franco Morbidelli to take pole with a time of 1:50.499.
The younger Marquez had to settle for second once more, with his time 0.101s off the best time from the Ducati rider.
Quartararo was able to hang on to a front row start as he completed his best qualifying session of the season in third.
Morbidelli set his best lap time on his final run and heads the second row of the grid, ahead of team-mate Fabio Di Giannantonio in fifth and Maverick Vinales continued his strong showing around the Losail circuit in sixth.
Johann Zarco took seventh, sharing the third row of the grid with top rookie Fermin Aldeguer in eighth and Alex Rins in ninth.
Ai Ogura completed the top ten after progressing through Q1, as Bagnaia ended up 11th following his late crash. Pedro Acosta rounded out the fourth row in 12th.
Marco Bezzecchi narrowly missed out on a place in Q2 as he ended qualifying in 13th ahead of team-mate and reigning champion Martin on his return, with Luca Marini joining the two Aprilia riders on the fifth row of the grid.
Jack Miller qualified in 16th ahead of Raul Fernandez in 17th, while Brad Binder continued his difficult struggles aboard the KTM in 18th.
Stand-in rider Augusto Fernandez had a decent showing for the Pramac Yamaha outfit in 19th and heads the seventh row, with Enea Bastianini in 20th and Joan Mir down in 21st.
Rookie Somkiat Chantra completed the standings after qualifying in 22nd.