The Italian stalked Martin across the opening half of the encounter before finally finding a gap down the inside at the final bend, though he found himself unable to make much ground on the Styrian GP winner thereafter.
Bagnaia was able to edge clear as Martin-who failed to get any sleep overnight due to feeling ill- began to struggle for speed in the closing tours, allowing a resurgent Miller to challenge.
Bagnaia would ultimately storm across the line to take the chequered flag just 0.489s ahead of Martin, the 2018 Moto3 world champion doing just enough to keep Miller at bay as Ducati scored a dominant 1-2-3 result-all three pilots within 0.823s of one-another.
Martin’s second place run would also secure him the rookies championship having entered the weekend three points adrift of Enea Bastianini, the Avintia racer coming home eighth.
Mir would eventually take fourth after fading back in the latter segment of the sprint, with 2021 MotoGP world champion Fabio Quartararo ending his year on a rather average note in fifth after pressuring the Suzuki over the final few laps.
Johann Zarco was sixth ahead of KTM’s Brad Binder, with Bastianini shrugging off his poor qualifying run to 18th to steal eighth from Aprilia’s Aleix Espargaro in the closing moments.
Rossi meanwhile enjoyed a solid final premier class outing to round out the top ten, the seven-time premier class champion leading home VR46 protégé Franco Morbidelli and Petronas SRT team-mate Andrea Dovizioso across the line.
Alex Marquez was the sole Honda to reach the end following the withdrawal of both factory RC213-V’s prior to the race and after team-mate Takaaki Nakagami crashed early on, the two-time MotoGP podium finisher coming home a quiet 13th.
Iker Lecuona grabbed one final point in his last MotoGP outing for Tech 3, while team-mate Danilo Petrucci ended his premier class career 18th as the final classified rider.
Alex Rins went down from third after looking good to challenge the leading Ducati’s early on, the three-time MotoGP race victor braking too late for Turn 6 and losing the front of his GSX-RR.
His mistake proved costly as he dropped behind both Martin and Bastianini to 13th in the overall riders standings, the former’s runner-up result catapulting him from 14th to ninth despite missing four races through injury.
Ducati also wrapped up its maiden teams championship to go along with the constructors accolade it secured one week ago in Portimao with its 1-3 finish to close out the 2021 campaign.