It was a tough day for the established contenders for victory on Sunday with Danilo Petrucci in third place while morning pacesetter Marc Marquez could only make sixth.
The established order was further upset by Spaniard Pol Espargaro who was fourth on a KTM.
Bagnaia, on a Ducati-Pramac, was last year's Moto2 world champion who, like Quartararo, has stepped up to the top category this year.
On Ducati's home circuit, an hour's drive from the Italian marque's headquarters in Borgo Panigale, Bagnaia, who rides for a satellite team, eclipsed the two factory riders.
Italians Petrucci and Andrea Dovizioso were third and 11th on their Ducatis.
"Friday went pretty well," Ducati Primac said on their Twitter account.
The gaps were very small however, with the top nine separated by less than half a second and the top 18 by a second, suggesting very tight qualifying on Saturday.
Petrucci blamed of a sore throat for his relative underperformance. Dovi, second in the world championship, said he had not "yet found the best feeling" on his machine.
Further back came Suzuki's Alex Rins, seventh, while the session was marked by spills for the other Ducati-Primac rider, Australian, Jack Miller, who ended ninth, and Frenchman Johann Zarco on the other KTM, who was 12th. Both were unscathed.
"This track is incredible," said Quartararo, who rides for Yamaha. "I'm enjoying myself a lot on this bike."
Championship leader and reigning champion Marquez, said he worked on Friday on the best possible combination of tires for the race and also said he was a little under the weather.
"I am still a little bit sick from yesterday and also the bike wasn't 100 per cent either," Marquez said. "Hopefully a good night's rest will help us both to be back at 100 percent tomorrow!"
In Moto2, Italy's Luca Marini, Valentino Rossi's half-brother, was the fastest ahead of another Kalex rider Switzerland's Thomas Luethi. Nicolo Bulega, also on a Kalex, was the first to cross the 300 km/h mark on the long straight, with the Moto2s now equipped with the Triumph three-cylinder engine proving faster this year.
1. Francesco Bagnaia (ITA/Ducati-Pramac) 1:46.732
2. Fabio Quartararo (FRA/Yamaha-SRT) 0.046
3. Danilo Petrucci (ITA/Ducati) 0.131
4. Pol Espargaro (ESP/KTM) 0.234
5. Maverick Vinales (ESP/Yamaha) 0.241
6. Marc Marquez (ESP/Honda) 0.330
7. Alex Rins (ESP/Suzuki)0.435
8. Cal Crutchlow (GBR/Honda-LCR) 0.438
9. Jack Miller (AUS/Ducati-Pramac) 0.453
10. Franco Morbidelli (ITA/Yamaha-SRT) 0.536