A qualifying session plagued by rain was eventually lit up in the closing stages as the Australian grabbed the 37th pole of his career.
Stoner edged out his Repsol Honda team-mate Dani Pedrosa by 0.115 seconds with championship leader Jorge Lorenzo of Yamaha in third.
Britain's Cal Crutchlow (Tech 3 Yamaha) showed no ill-effects from his fractured left ankle, sustained in the previous round at Silverstone, as he was fifth quickest just behind LCR Honda rookie Stefan Bradl.
Last year's winner Ben Spies was sixth fastest for Yamaha, in a session twice interrupted by rain, with Crutchlow's team-mate Andrea Dovizioso heading up the third row.
Ducati endured a disappointing day as Nicky Hayden and former world champion Valentino Rossi were ninth and 10th respectively.
After crashing heavily in final practice Stoner looked to be struggling as he languished in ninth when the second rain break arrived.
But after swapping to soft tyres he started to test the front-runners before posting the day's best time of one minute 33.713secs in the final stages.
Stoner, who is set to retire at the end of the season, is 25 points behind championship leader Lorenzo.