Honda rider Marquez passed Dovizioso with three laps remaining at one of his strongest venues on the calendar to claim a victory that puts him within touching distance of his fifth MotoGP title.
Andrea Iannone threatened to make it a three-way fight for honours at one stage but settled for third, marking the Suzuki rider's first top-three finish since May's Jerez race.
One likely victory contender dropped out at the very start, as poleman Jorge Lorenzo drifted wide at the first corner and suffered a major high-side crash, one that resulted in the Ducati rider sustaining a dislocated toe.
That left second-place starter Dovizioso leading Marquez and the two Suzukis of Alex Rins and Iannone, who spent the opening part of the race squabbling over third.
The order out front remained more or less unchanged as a large train of riders formed, but at around half-distance Dovizioso and Marquez started to edge away from their pursuers.
Marquez made a move on lap 14 of 23 to retake the lead into Turn 14, but Dovizioso stuck with the reigning champion and grabbed the advantage back two laps later.
Their battle allowed the two Suzukis, now with Iannone leading the charge, back into the frame, and on lap 19 the Italian rider came very close to taking the lead as a Marquez attack on Dovizioso went awry.
Marquez ran slightly wide at Turn 14, and found himself sandwiched between Dovizioso and Iannone heading through Turn 15 heading onto the long back straight in one of the race's more memorable moments.
But Marquez soon took back second and, after a failed attempt at passing Dovizioso on lap 20, he made the move stick heading into the first corner on the next tour - and duly extended a small gap to win by six tenths.
Iannone finished ahead of Rins to claim Suzuki's fifth podium of the season. That also means the brand will lose its concessions for 2019.
Dani Pedrosa had a largely lonely run to fifth on the second works Honda, ahead of surprise package Aleix Espargaro (Aprilia), who made a storming start from 13th on the grid and stayed in sixth for the entire distance thereafter.
Danilo Petrucci (Pramac Ducati) was the leading independent ride in seventh, the position LCR Honda rider Cal Crutchlow occupied in the early laps before crashing at Turn 1.
Valentino Rossi made a late pass on Pramac Ducati rider Jack Miller to claim eighth on the best of the Yamahas, making up nine places from his lowly grid position, while team-mate Maverick Vinales completed the top 10.
Sole KTM runner Bradley Smith threatened for a top 10 finish at one stage before slumping to 13th, behind satellite Honda runners Franco Morbidelli and Takaaki Nakagami, while Johann Zarco (Tech3 Yamaha) and Karel Abraham (Nieto Ducati) completed the scorers.
Jordi Torres finished 20th on his MotoGP debut for Avintia Ducati, but ended up just half a second down on team-mate Xavier Simeon at the flag.
Alvaro Bautista (Nieto Ducati) was the only other crasher besides Lorenzo and Crutchlow.