The Spaniard, who put in 72 laps, clocked 1min 59.368 seconds -- 0.138 seconds faster than reigning world champion Marquez on a Honda who put in 85 laps.
Italian Andrea Divizioso, on a Ducati, clinched the third fastest spot at 1min 59.553 seconds while Honda's Dani Pedrosa was fourth fastest at 1min 59.578 seconds.
Light rain briefly hampered the action in the early afternoon but riders were undeterred once dry conditions resurfaced.
Motorcycling superstar Rossi -- debuting Yamaha's new fairing with "internal" winglets in Sepang following the ban on external ones this year -- registered 1min 59.589 seconds on the clock to take the fifth spot.
The Italian superstar is targeting an elusive 10th world title in a new MotoGP season dominated by riders switching allegiances and thereby changing bikes too.
Three-time world champion Jorge Lorenzo, adjusting to his new Ducati, was the ninth fastest at 1min 59.767 seconds.
It was a vast improvement from day one when he was 17th fastest but he leapt up the timesheets on day two to number eight.
Suzuki's Andrea Iannone, the fastest rider on day two on Tuesday, was 11th fastest on Wednesday at 2mins 00.045 seconds.
The second round of testing will be held on Phillip Island in Australia from February 15-17 and a third round in Qatar from March 10-12.
The 18-race MotoGP season gets under way in Qatar on March 26.