The polesitting Honda rider dropped to third at the start as Jorge Lorenzo and Dani Pedrosa got off the line much better.
The title-contending trio then ran in very close company for the first half of the race.
Marquez eventually got ahead of his Honda team-mate with a clever move on the infield, but Lorenzo's Yamaha clung on at the front until half-distance, when Marquez slipped through into Turn 2.
Contrary to expectations, Marquez did not immediately disappear when in the lead, but going into the closing stages he was able to stretch his legs, winning by three and a half seconds.
Pedrosa made it a Honda one-two when he drafted past the fading Lorenzo with two laps left.
Valentino Rossi made a muted start to the race and took his time to work forward from 10th.
But by the end of the race he had caught the battling Cal Crutchlow and Alvaro Bautista. Some incredible and forceful racing resulted before Rossi grabbed fourth on the line by just 0.060s from Crutchlow.
Behind the lonely Stefan Bradl, the Ducatis' race-long battle got even more wild.
Contact between Nicky Hayden and Andrea Dovizioso at the final corner sent both bouncing over the kerbs and allowed Bradley Smith - who had jumped to fourth at the start - to pip them both.
Aleix Espargaro recovered from his qualifying crash to beat Colin Edwards to CRT honours.