General Motors sold 10 million cars in a year for the first time in its century-plus history.

Strong sales in China more than made up for slower sales in the United States. The milestone led GM, the largest American automaker, to record profit.

GM was in third place among world automakers, behind Volkswagen (VLKAF), which sold 10.3 million cars, and Toyota (TM), which sold 10.2 million.

GM (GM) was the world's largest automaker for 77 years but lost the title to Toyota in 2008. Volkswagen topped global sales for the first time in 2016.

China is now GM's largest market. Sales growth there lifted it to volume it never achieved when it was the world's biggest automaker. GM recorded its fourth straight year of record sales even as U.S. sales fell slightly, the first decline in GM's home market since 2009.

The U.S. car market, which rose seven straight years to its own record, may have topped out in 2016. Sales are forecast to decline slightly this year. GM has announced three rounds of layoffs at its American plants, costing 3,300 jobs, its first cuts since 2010.

Related: GM to invest $1 billion in U.S. plants, add or keep 7,000 jobs

Still, GM is predicting improved results in 2017, thanks in large part to China. GM makes most of its cars for that market in China, though it does export some, mostly Buicks from the United States.

The record sales last year lifted GM to a record operating profit of $12.5 billion, up 16%. Only seven years ago, GM suffered through a federal bailout and bankruptcy.

Related: 2,000 GM workers lose jobs on Trump Inauguration Day

The success is good news for GM's 52,000 U.S. factory workers, who will get profit-sharing payments of as much as $12,000 apiece. That's up from a maximum payment of $11,000 a year ago.

It was a record year for profit-sharing in the auto industry under new contracts with the United Auto Workers union. About 40,000 workers at Fiat Chrysler got an average payment of $5,000, a record there, while Ford paid an average of $9,000 to 56,000 workers, down slightly from the year before.