The win in Buri Ram gives him an insurmountable lead over closest rival Andrea Dovizioso with four races left in the season.
Spain's Marquez finished in 39min 36.223sec just ahead of 20-year-old rookie Frenchman Quartararo with another Spaniard Maverick Vinales third.
Italian Dovizioso came fourth, followed by another Spaniard Alex Rins.
Marquez jumped up and down with joy after the victory and was handed a large eight-ball to signify the eight overall championships across all classes he has won (Moto2 in 2012 and 125cc in 2010).
Starting from third on the grid, Honda's Marquez quickly slipped by Vinales and spent most of the race trying to overcome Quartararo (Petronas Yamaha) who led from pole position.
Quartararo held the lead through 25 of the 26 laps but Marquez made his move on the final lap, flying past the leader as the crowd screamed in delight.
Marquez told reporters that it was now "time to enjoy it" after a high-pressure season with many competitors clamouring to topple the reigning champion.
"Everybody is looking to beat you, it's not easy," a relieved-looking Marquez said.
With six premier class titles, the 26-year-old superstar now pushes past Australian legend Mick Doohan.
He trails only Italian great Valentino Rossi, who won the last of his seven championships in 2009, and Giacomo Agostini, whose record eight came in 1975.
Quartararo admitted that he was "really frustrated" at losing in such a close fight but recognised that it was a great result considering who he was up against.
"We tried until the last corner," he said.
The stunning performance on Sunday came after Marquez crashed hard in practice on Friday and had to go to hospital. The Spaniard was declared fit to race and rebounded to finish third in qualifying.
Marquez won the inaugural race in Buri Ram last year in another last-corner thriller against Dovizioso.
Italy's Luca Marini won the Moto2 while Spain's Albert Arenas claimed the Moto3 victory.
Read original story here.