General Motors and its partners sold 9 million vehicles around the globe in 2011, the company announced Thursday, allowing it to reclaim the title of world’s top-selling automaker.

Toyota had snatched the crown from General Motors in 2008, as the American automaker nearly crumbled under the weight of its debts and as U.S. auto sales plummeted with the recession.

The 2011 sales figure reflects the dramatic turnaround that began when the company filed for bankruptcy less than three years ago and, according to analysts, stems from the popularity of its latest vehicles.

GM has “demonstrated the ability to introduce competitive products and do it consistently,” said Jeremy Anwyl of the automotive Web site

Overall, the U.S. auto industry, which had seemed to be on the brink of collapse at the onset of the recession, has strengthened.

In the darkest days, as the country slipped into economic crisis, even President-elect Barack Obama reportedly asked his advisers on the U.S. auto industry, “Why can’t they make a Corolla?” according to a book by Steve Rattner, Obama’s former auto czar.

But since their government rescues, General Motors and Chrysler have both far exceeded analysts’ expectations for profit and sales. And at Ford, U.S. sales exceeded 2 million in 2011 for the first year since 2007.

GM has even come up with an answer to the Corolla challenge. Today, the company’s best-selling vehicle globally is the Cruze, a compact car introduced last year that has competed well against Toyota’s stalwart.

“We set out to build a better car than the Corolla, and we did,” said James Cain, a GM spokesman. “The Chevy Cruze was the best-selling compact car in the U.S. last year.”

Even with GM’s sales success, however, the United States has still not been fully repaid the $50 billion it invested directly into the company to rescue it.

So far, GM has returned $23 billion, and the government still owns about one-third of the company’s common stock. For the government to recover its full $50 billion investment, its General Motors stock would have to rise to about $54 per share. It is currently selling for about $25.

This year’s GM sales results also underscore the growing importance of the Chinese market.

Of its 9 million in global sales, GM and its joint ventures sold a record 2,547,171 vehicles in China in 2011.

The company’s next-best-selling car, after the Cruze, is one that most Americans likely have never heard of: the Sunshine. An inexpensive and spare-looking minivan, the Sunshine is sold in China and manufactured by a joint-venture company called ­SAIC-GM-Wuling Automobile.

Because a significant share of GM’s 9 million in global sales came from its Chinese joint ventures and not wholly owned subsidiaries, some analysts have questioned how meaningful the figure is.

But GM also benefited this year because of a spate of misfortunes for Toyota.

Toyota hasn’t reported full-year results, but its sales have been hampered by the earthquake in Japan and floods in Thailand. Company officials have estimated that 2011 sales decreased to 7.9 million.

Volkswagen says it sold a record 8.2 million cars and light trucks last year, a 14 percent rise over 2010. Through Porsche and another company in which Volkswagen owns a more than 50 percent stake, the German automaker sold 240,000 more, an official said.

Volkswagen has also announced its intention to become the world’s largest automaker by 2018.

“It’s going to be harder for [GM] to claim the top spot in 2012,” Anwyl said. “This year, they had a tail wind.”