The reigning World Champion, reportedly using the latest RC213V engine on both his bikes, took over the P1 slot from Maverick Vinales early in the morning.
He improved his lap time to a 1:29.497 to pull half a second clear of the new Yamaha rider.
However, a late burst from Rossi saw him finish the day as Marquez's nearest challenger.
The Italian clocked a 1:29.683 on his penultimate lap of the afternoon to finish 0.186s shy of his Honda rival.
Andrea Iannone was another rider who improved late in the day, taking third place ahead of Vinales.
Cal Crutchlow had a good day on the LCR Honda as he was fifth fastest ahead of Danilo Petrucci, Dani Pedros and Andrea Dovizioso.
Dovizioso's new teammate, Jorge Lorenzo, was 11th on the day, 1.134s off the pace.
There were falls on the day for Sam Lowes and Alvaro Bautista, which necessitated repairs to the tyre wall at Turn 6, while Scott Redding, Hector Barbera and Pol Espargaro also went down.
TIMES
1. Marc Marquez Repsol Honda Team (RC213V) 1m29.497s
2. Valentino Rossi Movistar Yamaha MotoGP (YZR-M1) 1m29.683s 0.186s
3. Andrea Iannone Team Suzuki Ecstar (GSX-RR) 1m29.926s 0.429s
4. Maverick Viñales Movistar Yamaha MotoGP (YZR-M1) 1m29.989s 0.492s
5. Cal Crutchlow LCR Honda (RC213V) 1m30.065s 0.568s
6. Danilo Petrucci Octo Pramac Yakhnich (Desmosedici GP17) 1m30.262s 0.765s
7. Dani Pedrosa Repsol Honda Team (RC213V) 1m30.281s 0.784s
8. Andrea Dovizioso Ducati Team (Desmosedici GP17) 1m30.410s 0.913s
9. Jack Miller Estrella Galicia 0,0 Marc VDS (RC213V) 1m30.426s 0.929s