China's economy accelerated for the first time in seven years in 2017, growing 6.9 percent from the previous year, official data showed Thursday, boding well for President Xi Jinping's drive to achieve the goal of building a "moderately prosperous society."

The growth in gross domestic product easily beat Beijing's target of around 6.5 percent. Robust exports and internal demand, underpinned by the government's stimulus measures, were behind the sharp economic expansion.

In 2016, China's economy grew 6.7 percent from the previous year, marking the weakest annual expansion in 26 years.

Xi, who began his second five-year term as the country's leader in October last year, has pledged to realize a society where all citizens can enjoy comfortable lives before 2021, the 100th anniversary of the ruling Communist Party's founding.

"The national economy has maintained the momentum of stable and sound development and exceeded expectations with firm steps taken to secure a decisive victory in building a moderately prosperous society in all aspects," the National Bureau of Statistics said.

But many analysts are skeptical about whether China's economy will continue to expand at the same pace in 2018, given that Xi's government has taken further action to restrain the overheated property market and protect the environment.

Beijing's stricter environmental regulations are expected to boost imports of eco-friendly natural gas while weighing on production at home, which could slow economic growth across the board.

Concerns are also mounting that a possible real estate bubble and mounting corporate debt could drag down the world's second-largest economy in the near future.

Should Beijing implement tighter monetary policy to ease financial risks, the pace of China's economic expansion would slow in 2018, economists have warned.

China should "be aware that there are still difficulties and challenges confronting the economy, and the improvement of quality and efficiency remains a daunting task," the statistics bureau said.

Chinese GDP last year totaled 82.71 trillion yuan (about $12.86 trillion), according to the bureau.

In 2017, retail sales of consumer goods jumped 10.2 percent from a year earlier and exports surged 10.8 percent due in part to the global economic recovery. Online retail sales skyrocketed 32.2 percent on the back of the rapid spread of e-commerce shopping.

Fixed asset investment, including spending on infrastructure, rose 7.2 percent, while investment in real estate development climbed 7.0 percent last year.

To realize the moderately prosperous society, defined by Beijing as doubling its 2010 GDP and per capita income by 2020, China's economy needs to expand at an average annual rate of around 6.5 percent until then.

China's GDP increased 6.8 percent in the third and fourth quarters of 2017 after growing 6.9 percent during the first and second quarters, the bureau said.

The latest data were the first year-on-year growth figures since the Communist Party's twice-a-decade congress in October last year, during which Xi promised to continue with the country's ongoing economic structural reforms and further liberalization of its economy.