Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

BEIJING — China suffered its worst economic contraction since at least the 1970s in the first quarter as it fought the coronavirus, and weak consumer spending and factory activity suggest it faces a longer, harder recovery than initially expected.

The world’s second-largest economy shrank 6.8 percent from a year ago in the three months ending in March after factories, shops and travel were closed to contain the infection, official data showed Friday.

That was stronger than some forecasts that called for a contraction of up to 16 percent but China’s worst performance since before market-style economic reforms started in 1979.

Some forecasters earlier said China, which led the way into a global shutdown to fight the virus, might rebound as early as this month. But they have been cutting growth forecasts and pushing back recovery timelines as negative trade, retail sales and other data pile up.

“I don’t think we will see a real recovery until the fourth quarter or the end of the year,” said economist Zhu Zhenxin at the Rushi Finance Institute in Beijing.

Retail spending, which supplied 80 percent of China’s economic growth last year, plunged 19 percent in the first quarter from a year earlier, below most forecasts. Investment in factories and other fixed assets, the other major growth driver, sank 16.1 percent.

The ruling Communist Party declared victory over the virus in early March and started reopening factories and offices even as the United States and Europe tightened controls. But cinemas, hair salons and other businesses that are deemed nonessential but employ millions of people are still closed. Tourism is struggling to recover.

Controls on Beijing, the capital, and some other cities have been tightened to prevent a resurgence of the disease. Most foreigners are barred from entering the country.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Consumer spending is slow to recover despite government moves to encourage spending by giving out shopping vouchers in some cities and launching a media campaign showing officials eating in restaurants.

Many would-be shoppers are holding onto their money out of fear about possible job losses. Others are reluctant to venture into supermarkets or even leave their homes.

That is a blow to automakers and other companies that hope China will power the world economy out of its most painful slump since the 1930s.

“I will definitely be more thrifty,” said Zhang Lizhou, a 26-year-old marketing manager in Beijing.

Zhang said his company, which has yet to reopen, is paying him 1,500 yuan ($215) per month but his finances are strained paying a mortgage. His girlfriend lost her job when her employer failed due to the epidemic.

“I will save money to get through possible difficulties,” Zhang said. “If I had done that, I wouldn’t be like what I am now — anxious but unable to do anything.”

The ruling party appealed to companies to keep paying employees and avoid layoffs. It is promising tax breaks and loans to help entrepreneurs get back on their feet. Still, a wave of bankruptcies has flooded the job market, adding to economic anxiety.

Auto sales sank 48.4 percent from a year earlier in March. That was better than February’s record 81.7 percent plunge but is on top of a 2-year-old decline that already was squeezing global and Chinese automakers in the industry’s biggest global market.

Exports declined 6.6 percent in March from a year ago. That was an improvement over the double-digit plunge in January and February, but forecasters warn exporters likely face another downturn as the fight against the virus depresses U.S. and European consumer demand.

Forecasters including Oxford Economics, UBS and Nomura say China will have little to no economic growth this year.

The operator of a still-shuttered fitness center in the western city of Xi’an said he doesn’t know whether the business will survive.

“The business may go bankrupt, and I would have to find something else to do,” said the owner, who would give only his surname, Liu.

Beijing is trying to prop up activity by spending more on building next-generation telecoms networks and other projects. But the ruling party doesn’t want to pump too much money into the economy for fear adding to debt or pushing up inflation that is near a seven-year high.

Chinese leaders probably will adopt stimulus measures at least as big as their response to the 2008 crisis but will emphasize “quality instead of quantity,” said Zhu at the Rushi Finance Institute.

He said money was likely to go to technology development and social welfare instead of construction, as it did in 2008.

Last year’s economic growth sank to a multi-decade low of 6.1 percent under pressure from weak consumer demand and a tariff war with President Donald Trump that depressed exports.

“The epidemic has amplified the problems, so the pace of recovery will be much slower,” said Zhu.