Jorge Martin made a brilliant start from pole to lead into turn one, while Bagnaia went from second to fourth.
On lap two, Martin and Miller briefly exchanged the lead at turns one and two, before a lovely move at turn four from Joan Mir put him second ahead of Miller.
Lap three saw Valentino Rossi, who made a good start from tenth to ninth, then lose that spot to Pramac rider Johann Zarco, who himself had a dreadful start.
While the Frenchman then got stuck behind Brad Binder in eighth, fellow Ducati rider Bagnaia got ahead of Mir for P2 along the start-finish straight.
Mir was then relegated to fourth five corners later as team-mate Rins also came through. The #42, who was incredibly strong on the brakes, then made another stunning move at turn six to claim second off Bagnaia – lap five.
Behind the front four, Miller lost yet another place after 2021 World Champion Fabio Quartararo moved ahead of the Australian at turn four.
Rossi was able to stick with Binder and Zarco for the next few laps, however, impressive rookie Enea Bastianini then pushed the nine-time world champion down to P11.
Takaaki Nakagami’s dismal 2021 season ended with yet another crash as he became the first rider to lose the front at turn six.
While Martin continued to look rock solid out front, Bagnaia moved back into second with a lovely overtake on Rins, before things got considerably worse for the Suzuki rider on lap 11 as he crashed at turn six.
After several close looks at turn six, Bagnaia finally managed to overtake Martin for the lead – final corner move.
Bagnaia then set the fastest lap of the race to put four tenths into Martin. Meanwhile, Miller began closing in on Mir who was missing several apex’s as he struggled to keep the pace of Bagnaia and Martin.
With nine laps to go, Miller made it an all-Ducati podium thanks to a late braking move on Mir at turn two.
Rossi’s final race was continuing to be a good one as he remained in tenth with six laps to go, however, the same couldn’t be said for Danilo Petrucci who was last of the current runners.
The battle for victory continued to be close as Miller began reeling in the front two. The Jerez and Le Mans race winner looked on the absolute limit in trying to do so, however, that didn’t stop him from getting closer to Martin in particular.
But just as he got close on the penultimate lap, Martin then set one of his fastest laps to maintain P2.
Mir came under late pressure from Quartararo for fourth, but the Suzuki rider ultimately kept ahead. Zarco, Binder, Bastianini, Aleix Espaargaro and Rossi rounded out the top ten.