Marquez led most of the 20-minute session, first taking the lead with a 1m24.594s, then setting two 1m24.3s and then a 1m24.239s with five minutes left on the clock.
The Honda rider then fell at Turn 3, and while he was able to carry on, no more improvements came from Marquez.
Dovizioso spent most of the session in the lower half of the top 10 but took over the lead in the very end with a 1m24.138s, beating Marquez by a tenth.
Jorge Lorenzo in third was over four tenths off the pace, while Suzuki's Andrea Iannone, recovering from an off-track excursion, beat Cal Crutchlow to fourth by 0.003s.
KTM and Aprilia riders Bradley Smith and Aleix Espargaro took sixth and seventh respectively.
Suzuki's Alex Rins completed the top eight, followed by Dani Pedrosa and the Yamaha factory duo of Maverick Vinales and Valentino Rossi.
Pramac Ducati riders Danilo Petrucci and Jack Miller were 12th and 13th respectively, while Tech 3 Yamaha's Johann Zarco took 14th.