The Honda rider set a best time of one minute 47.804 seconds, keeping his Spanish compatriots and closest rivals Jorge Lorenzo and Dani Pedrosa in second and third place respectively on the grid.
Marquez tops the world rankings with 253 points, 34 ahead of both Lorenzo and Pedrosa, with five races left this season.
"In all honesty, it was a tough battle for pole as Jorge and Dani were both very fast," 20-year-old rookie Marquez told reporters.
"With the second set of tyres I found something extra and this allowed me to take pole. It will be important to manage the tyres well tomorrow."
World champion Lorenzo was happy enough to be second on the grid as he goes in search of a third consecutive victory following wins in Britain and San Marino.
"I am pleased because I didn't expect to round in (1:47.814). It's an incredible time on this circuit," the Yamaha rider said.
"Second place is very good for tomorrow and the important thing is that it doesn't rain and we can set a good rhythm for the race."
Overnight rain had left a damp track for the Saturday morning practice session and there is a chance of further rain over the rest of the weekend.
Italy's Valentino Rossi headed up the second row, ahead of Germany's Stefan Bradl and Spaniard Alvaro Bautista.
In Moto2, another Spaniard, Nico Terol, grabbed pole position, his first in this class, ahead of compatriots Esteve Rabat and Pol Espargaro.
Britain's championship leader Scott Redding managed to secure only 13th place.