Updated

Surprise! The top-performing stock among automakers in the U.S. last quarter was General Motors.Ahe

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% 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%. GM posted strong profits in that period.

GM's stock outperformed all other major automakers in the U.S. including rival Ford Motor, which saw its shares rise 3%.

General Motors' 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.

"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., Honda Motor. and Nissan Motor each lost ground during the quarter, with Toyota down 2.5%, Honda off 11% and Nissan down 9%.

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. "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% 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 (26.5%) 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.

The automaker posted a $361 million pretax loss in the region in the second quarter. During the third quarter, GM 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% over a year earlier, but the whole market grew almost 15%.

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.