Francesco Bagnaia survived a late scare to finish second in the Qatar MotoGP as his only title rival Jorge Martin limped home 10th complaining he had been given a bad tyre.
Fabio Di Giannantonio, who does not have a ride next season took his first victory and, he said, "revenge" on "everybody who doubted me."
Luca Marini was third on a VR46 Ducati.
Defending champion Bagnaia leads Martin by 21 points with one weekend left in Valencia where the maximum haul for a rider who wins both the sprint and the main race is 37 points.
Martin had cut Bagnaia's lead to seven points by winning the sprint the day before. But in the main race, the Spaniard slipped to ninth after a bad start and struggled throughout on his Ducati Pramac, eventually coming home 10th.
"I had a really bad rear tyre," the Spaniard said. "You could see already see at the start when you start to spin and you are the only one."
"I think it's a pity that the championship is decided by a bad tyre," he said. "We are in MotoGP and this unacceptable. I had the potential to win the race. I feel like they beat me outside the track not on the track."
Bagnaia had no such problems, sweeping into the lead from the start on his Ducati with only fellow Italian Di Giannantonio able to keep up.
"I was alone in the front. I tried to push but Digia today was incredible," said Bagnaia.
Di Giannantonio bided his time behind Bagnaia saying he was aware that his rival was chasing the title and did not want to take him out.
"I'm sorry for him if I stole five points from him," said Di Giannantonio. "I tried to be as smooth as possible but I was trying to win my first race. I think my pass was worth it."
Bagnaia was prepared to take the risk.
"I wanted to win today. It was the only possibility for me."
He almost paid, going off the track as he hit back.
"I got sucked by his slipstream on the braking and I went totally wide," said Bagnaia.
"I was lucky with the pace we made we had a big gap."
- 'Best situation' -
At Valencia next weekend, Bagnaia could wrap up a second title in Saturday's sprint race.
Last season, when there was no sprint, Bagnaia went to Valencia with a 23-point lead and finished ninth to win the title by 17 points from Fabio Quartararo.
"We are arriving in the best situation compared to Jorge," said Bagnaia.
Martin was third in Valencia last season.
"It will be really difficult in Valencia but I will try to fight," he said. "It's a really nice track for me."
Di Giannantonio is being replaced by six-time world champion Marc Marquez at Gresini and does not have a ride for next season, with few saddles still available.
"This is a real redemption today," he said. "A real revenge for myself but also for everybody who doubted me. We did it. Guys we are a MotoGP winner."
Fermin Aldeguer, the 18-year-old Spaniard who is expected to take one of the few available seats in MotoGP next season, won the Moto2 race with compatriot Pedro Acosta, who had already clinched the title, eighth.
Jaume Masia won in Moto3 to take the title but the victory was cloaked in controversy for the way Masia and his Leopard Honda team-mate Adrian Fernandez repeatedly bumped the Husqvarna of his title rival Ayumu Sasaki.
Sasaki finished sixth.