Martin (Prima Pramac Racing Ducati) had closed the gap to seven points behind Ducati Lenovo Team rider Bagnaia after barging his way to his eighth Sprint race victory the previous day, with the Italian struggling to fifth.
On Sunday however he was in trouble from the lights.
Martin’s rear tyre spun on the grid as Bagnaia made the perfect start. Martin dropped through the pack to finish tenth by the chequered flag.
At the front, Bagnaia was battling with Gresini Ducati’s Di Giannantonio for the win.
With three laps to go Di Giannantonio squeezed past Bagnaia to lead for the first time in the race.
Bagnaia fought back at Turn One but ran wide, nearly clipping the rear of his fellow Italian under braking.
As Di Giannantonio, who has no ride in 2024, went on to claim an emotional first-ever MotoGP victory, Bagnaia bagged 20 points to head into the final round in Valencia this weekend with a 21 point advantage over Martin.
With 37 points remaining on the table, the championship is Bagnaia’s to lose.
Pole setter Luca Marini brought the Mooney VR46 Racing Ducati home third making it an all-Italian and Ducati podium.
After claiming his first podium in the Sprint race and his first MotoGP victory, the Italian was in tears after the race.
“It has been an incredible weekend,” he said. “The race was just unbelievable.
"When I was behind Pecco I knew I could have something more.
"In the middle of the race I was struggling with the front but then I saw he was doing little mistakes and I thought maybe today could be my opportunity.
"This is a real redemption, a real revenge.
"First for myself and also for everybody who doubted me. But now we did it, we are MotoGP winners.”
Elsewhere, Fermin Aldeguer claimed his third Moto2 win on the trot while British start Jake Dixon lost fourth to Ai Ogura in the run to the flag. Sam Lowes finished 12th.
Jaume Masia rode the race of his life to claim the 2023 Moto3 World Championship for Leopard Racing Honda.
The 23-year-old Spaniard took the championship in style, winning the race while his nearest title challenger Ayumu Sasaki could only finish sixth.
GASGAS Aspar’s David Alonso finished second in the race while Red Bull KTM Ajo KTM rider Deniz Oncu overcame a double long lap penalty, for jumping the start, to complete the rostrum.