China's economy had its foot on the gas in 2017.

Official data published Thursday showed the world's second largest economy grew 6.9% last year, beating analysts' earlier expectations. The performance was helped by government stimulus and an improving environment for global trade.

It's the first time since 2010 that China's official growth rate has accelerated from the previous year. The economy grew 6.7% in 2016.

Analysts have for years cast doubt on the authenticity of Chinese economic data. Entire provinces have at times admitted to fudging the numbers.

Related: Solar panel: A fight with China that Trump may want to avoid

This time is no different. Julian Evans-Pritchard, a China economist at research firm Capital Economics, said in a note to clients that he doubts the official figures "given how implausibly stable they have been in recent years."

He estimates the Chinese economy actually grew just 6% last year.

Healthy growth in 2017 was seen as particularly important for China's leaders. The ruling Communist Party held a key gathering in October, a showcase event that takes place once every five years and where President Xi Jinping aimed to project strength and stability.

This year may be weaker. Growth is expected to slow to 6.4%, according to an average of analyst forecasts compiled by Reuters.

Related: Trump and China: 2018 could get nasty

China may continue to benefit from an upswing in the global economy, but the country also faces potential problems.

Debt has ballooned in recent years. The amount companies owe is now more than one-and-a-half times the size of China's entire economy, according to the International Monetary Fund.

Authorities want to get that credit binge under control.

Wei Yao, an economist at Societe Generale, wrote in a research note that new measures to crack down on excessive borrowing "will surely have negative spillover effects" on the economy and could cause a "painful slowdown."

Related: China is America's biggest foreign creditor. Could it turn off the tap?

Threats to global trade may also begin to materialize, which would be a serious headache for China, the world's biggest exporter of goods.

President Trump has previously vowed to get tough with China on trade and may start following through this year with measures like heavy tariffs.

"More forceful U.S. trade restrictions on Chinese exports" could be in store, Louis Kuijs, an economist at Oxford Economics, warned in a note to clients Thursday.

But China's economy isn't losing much steam at the moment. In the fourth quarter of 2017, it grew 6.8%, the same pace as the previous three months.