Vinales first took the lead with a 1m31.983s with three minutes remaining but he was quickly demoted by Jorge Lorenzo.
But Vinales was able to improve two more times with a 1m31.549s and then a 1m31.428s to head an ultra-close classification, in which 15 riders slotted in within one second of the fastest time.
Marquez took second but was nearly two tenths slower than Vinales, with local hero Quartararo ending up third.
The Frenchman beat Lorenzo by three thousandths of a second, while Andrea Dovizioso took fifth, only 0.02s behind.
Dovizioso was the top Ducati in what was an otherwise difficult FP2 for the Italian firm, with Danilo Petrucci crashing while exiting Turn 8 at the very beginning of the session, while Pramac Jack Miller had crashes at T3 and T11 respectively.
Petrucci recovered to sixth followed by KTM’s Pol Espargaro, who also had two falls, and Aleix Espargaro, the Aprilia man another rider to crash in the end.
LCR Honda’s Takaaki Nakagami took ninth as the top nine riders in the session also hold the same positions in the overall practice classification.
Franco Morbidelli completed the top 10, narrowly edging Cal Crutchlow out, the Briton challenging for the top positions before crashing at Turn 6.
Rossi had to settle for 13th as he curiously started the late-session flying laps on a medium rear tyre, and a late change to soft left him with no time to move into the combined classification top 10.
Rain is forecast for Saturday, and should it arrive to the track early enough for FP3, Rossi could be forced to fight his way through Q1 along with several other usual frontrunners.
Suzuki duo Joan Mir, whose session also ended with a crash, and Alex Rins were only 14th and 15th respectively in FP2, ahead of Miller.
But Miller still ended the day in the overall top 10, by just 0.001s ahead of Morbidelli.