Bagnaia, a three-time winner in Mugello from 2022 to 2024, led the race until there were 10 laps left when Bezzecchi made his move before Martin also moved past the Italian to drop him down to third.
There was no stopping Bezzecchi after he moved into the lead as the Italian took the chequered flag over three seconds ahead of Martin for his first win at the famous circuit.
Meanwhile, Bagnaia's late heroics denied Aprilia a podium lockout when Trackhouse rider Ai Ogura briefly took third on the final lap before the Italian took the place back just before the finish line.
