The Australian seized the lead with six laps to go and pulled away at the head of the field thereafter, eventually finishing over five seconds clear of title rival Jorge Lorenzo, who had started from pole position.
Lorenzo led from the start on his Yamaha but was pursued by a chasing pack of Hondas - which diminished in number when the unpredictable Marco Simoncelli crashed from fifth place.
Dani Pedrosa initially led the pursuit of his fellow Spaniard but it was Stoner who made the breakthrough on lap 26 and was untroubled in claiming a fifth win of the year.
Pedrosa completed the podium in third ahead of Ben Spies and Andrea Dovizioso.
Stoner said after the race: "We felt good, really good, at the end.
"I think people have forgotten about us a little bit over the last few weeks. We've definitely struggled, but for some reasons that we know.
"It's really good to come back with a race like this and show everybody that we can still win."
Lorenzo, who suffered a nasty crash in yesterday's practice session, said: "I'm lucky to be in the second position this weekend, because after the crash yesterday morning, in the first moments I thought it wasn't possible to take part in the race.
"So after qualifying I really hoped to fight for the victory until the end. But sometimes expectations are not the reality, and today Casey was faster than us, especially at the end. He had something more than we had."