BEIJING — In the midst of a complex external environment, China’s economy has ended 2018 on firm footing, with better quality and improved structure.

The world’s second-largest economy grew 6.6 percent year-on-year in 2018, above the official target of around 6.5 percent, data from the National Bureau of Statistics (NBS) showed on Jan 21.

The reading was lower than the 6.8-percent growth registered in 2017.

Growth in the fourth quarter came in at 6.4 percent, down from 6.5 percent seen in the third quarter, NBS data showed.

The country’s economy has performed within a reasonable range in 2018, with economic growth being generally stable and improvement achieved in performance, Ning Jizhe, head of the NBS, said at a news conference.

Contributing to nearly 30 percent of the world’s economic growth, the country’s economy has remained the largest contributor to global economic growth, Ning said.

On a quarterly basis, the economy grew 1.5 percent in the fourth quarter, a notch down from a rise of 1.6 percent posted in the third quarter.

Gross domestic product (GDP) totaled 90.0309 trillion yuan (about $13.28 trillion) in 2018, with the service sector accounting for more than half of the total.

As the country sought to shift its economy toward a growth model that draws strength from domestic demand, consumption remained the major growth driver, contributing 76.2 percent to GDP growth last year. Retail sales, a main gauge of consumption, rose 9 percent from one year earlier.

The data also showed China’s fixed-asset investment increased 5.9 percent year-on-year in 2018, down from a rise of 7.2 percent in 2017.

Industrial output climbed 6.2 percent year-on-year last year, 0.4 percentage points lower than the previous year.

Consumer price index rose 2.1 percent year-on-year in 2018, achieving the government’s target of capping consumer inflation below 3 percent.

Employment remained stable, with more than 13 million new jobs created in urban areas last year and the surveyed urban unemployment rate standing at 4.9 percent in December.

Looking ahead, Ning Jizhe said China may face a more complicated and tough external environment for development in 2019, but the country has the foundation, condition, confidence and capability to keep economic growth within a reasonable range, ensuring sustained and healthy economic development.

Upbeat about the country’s economic outlook, Ning stressed favorable conditions for development, including opportunities brought by changes in global and domestic situation, a massive consumer market, rich resources and talents, development dividends unleashed by reforms and ample room for policy maneuver.