Yamaha rider Quartararo had to outscore Bagnaia by three points in Sunday's race to bring an end to the 2021 title battle with two races to go, but a career-worst finish of 15th in qualifying meant the Frenchman had plenty of work to do.
The 22-year-old gradually climbed the field after a slow start that saw him drop two more places, yet he was still fifth, well off leader Bagnaia, with five laps to go in Italy.
Then came an incredible moment as Ducati's Bagnaia, on course for a third victory in four races, lost the front of the Desmosedici into turn 15 to effectively hand Quartararo the title – and a first for Yamaha since 2015.
Quartararo continued his ascent into third place before dropping behind Enea Bastianini into his eventual final position of fourth, with Marc Marquez and Pol Espargaro leading a one-two for Repsol Honda.
It is a second successive triumph for Marquez on the back of his victory at the Grand Prix of the Americas.
1. Marc Marquez (Repsol Honda)
2. Pol Espargaro (Repsol Honda) +4.859s
3. Enea Bastianini (Avintia) +12.013s
4. Fabio Quartararo (Monster Energy Yamaha) +12.775s
5. Johann Zarco (Pramac Racing) +16.458s
6. Alex Rins (Suzuki Ecstar) +17.669s
7. Aleix Espargaro (Aprilia) +18.468s
8. Maverick Vinales (Aprilia) +18.607s
9. Luca Marini (Avintia) +25.417s
10. Valentino Rossi (Petronas Yamaha) +27.735s
1. Fabio Quartararo (Monster Energy Yamaha) 267
2. Francesco Bagnaia (Ducati) 202
3. Joan Mir (Suzuki Ecstar) 175
4. Johann Zarco (Pramac Racing) 152
5. Jack Miller (Ducati) 149
1. Monster Energy Yamaha 364
2. Ducati 351
3. Suzuki Ecstar 266
4. Repsol Honda 239
5. Pramac Racing 238