The 23-year-old Repsol Honda rider fought back after an early technical problem, which saw him briefly drop to fifth position from pole, to claim his fourth victory of the 2016 campaign.
Defending champion Jorge Lorenzo edged his Movistar Yamaha teammate Valentino Rossi for second place to further improve Marquez's title chances.
MotoGP legend Rossi ran wide on Turn 1 of the last lap and had to settle for third place, losing nine potential extra points in the championship battle.
The Italian trails Marquez by 52 with Lorenzo a further 14 points adrift.
Only four rounds of the season remain as Marquez looks to add to his 2013 and 2014 titles.
"Rossi was gaining points, so this is good," he told the official MotoGP website as he reflected on his victory.
Marquez had overtaken his arch rival on his way back through the pack and once he hit the front looked untouchable for his first win on home soil since 2014.
Rossi, desperate for a 10th world title to cap his glittering career, then came under pressure from Spaniard Lorenzo and was eventually overtaken with five laps remaining.
His last lap error made the second podium spot safe for Lorenzo, whose own chances of victory were compromised by a crash in the warm-up.
Another Spaniard, Maverick Vinales on a Suzuki, was an challenging fourth ahead of Cal Crutchlow of Britain.
Dani Pedrosa, who won the previous San Marino round on Rossi's home track at Misano, rounded out the top six.
Earlier, Brad Binder of South Africa wrapped up the Moto3 title after he finished second to Spain's Jorge Navarro at Motorland.