DETROIT -- Surprise! The top-performing stock among automakers in the U.S. this quarter is General Motors.The company, which endured management upheaval during the third quarter and announced that it would lose substantial cash in Europe, saw its shares rise 15 percent from July through the end of September. The gain was the best since the first quarter of this year, when the stock climbed about 23 percent. GM posted strong profits in that period.GM's stock outperformed all other major automakers in the U.S. including rival Ford Motor Co., which saw its shares rise 3 percent.General Motors Co.'s gains for the quarter surprised industry watchers, given publicity about management changes and the continued sales slump in Europe that has hit nearly every major automaker. During the quarter, GM ousted its marketing chief and the head of European operations. It also lost several other key executives including its top electric-car engineer and head designer in Europe.Investors now realize that most of the departures signal that GM is making necessary changes. That's better than sweeping management problems under the rug like it did in the past, said Bill Selesky, an industry analyst for Argus Research. The changes, he said, have set GM apart from its peers this quarter."I think people are now looking at the company and saying they're more proactive," Selesky said. "They're not the same company my father used to know."For the quarter, GM shares gained $3.05, from $19.70 on July 2 to $22.75 on Friday.U.S. shares of Japanese rivals Toyota Motor Corp., Honda Motor Co. and Nissan Motor Co.'s each lost ground during the quarter, with Toyota down 2.5 percent, Honda off 11 percent, and Nissan down 9 percent.GM got on many portfolio managers' buy lists during the quarter because it hit a 52-week low of $18.72 in July, and many thought they were buying at the bottom, said Joe Phillippi, president of New Jersey-based AutoTrends Consulting LLC. "You go for the bounce of the cycle," he said.Some of the investors might hold the stock longer because of GM's plans to boost sales by revamping 70 percent of its North American product lineup by the end of 2013, Phillippi said."Fit, finish, refinement, fuel economy numbers. It keeps getting better," he said of GM products.Longer-term, a rising stock price could help the U.S. government recoup the $50 billion it spent bailing out GM in 2008 and 2009. Treasury still holds 500 million shares of GM under that deal, but hasn't sold yet because of the relatively low price. GM stock would have to get to $53 for the government to break even.GM made $2.5 billion through the first half of the year. But it's predicting lower profits in the second half as losses continue in Europe. Car sales are in their fifth-straight year of decline there, and GM has lost money in Europe for a dozen years. GM posted a $361 million pretax loss in the region in the second quarter. During the third quarter, it warned that it may have to reduce the value of its European operations.But GM has been taking small steps to fix Europe, including an announcement in August that employees at two German plants would work reduced hours during the next few months.The fact that something is being done to change Europe is encouraging to investors, who see the company as a good short-term investment, Selesky said.GM still has problems to deal with elsewhere, including slow growth in China and North America. GM's U.S. sales are lagging behind overall market growth. Through August, U.S. sales grew 3.7 percent over a year earlier, but the whole market grew almost 15 percent.And if the new products in North America, including important new pickup trucks next year, don't boost GM's sales and market share, that will mean trouble for the stock, Phillippi said."If they don't pick up share, people will hammer them," he said.