BEIJING -- China's economy plummeted 6.8% in the first three months of the year compared with a year earlier, the country's first such drop since Beijing began reporting quarterly gross domestic product in 1992.

The sharp contraction in the world's second-largest economy offers a foreshadowing of the pain expected in the U.S. and around the world as the coronavirus pandemic shuts borders, halts business activity and cripples global supply chains.

China's 6.8% year-over-year pullback follows a 6% gain in the last three months of 2019 but is better than the 8.3% decline predicted by the median forecast of 15 economists polled by The Wall Street Journal.

Compared with the fourth quarter of 2019, China's GDP contracted by 9.8%.

The underlying picture offered some signs of recovery after the economy hit a nadir in February, though the numbers underscored the weakness of consumer spending.

China's urban jobless rate, which has for years remained largely static around 5% despite the ups and downs of the economy, remained at an elevated 5.9% at the end of March, after a 6.2% reading in February -- a record.

Industrial production fell 1.1%, versus expectations for a 7.5% pullback, while fixed-asset investment dropped 16%, in line with expectations. Retail sales fell 15.8% in March, much worse than expectations for an 8% decline.

Property investment fell 7.7% from a year earlier, while housing sales dropped 22.8%.

While the coronavirus has flattened the global economy, China has been reckoning with the crisis longer than any other country has. The virus first emerged there late last year and, beginning in mid-January, authorities shut down much of central Hubei province, with a population of nearly 60 million, and enforced a strict, roughly two-month-long shutdown of all but the most essential commercial activity.

"The nature of this shock is really different than anything we've ever seen in our lifetimes," said Andrew Tilton, chief Asia Pacific economist for Goldman Sachs. On an annualized basis, he said, the plunge in first-quarter growth is likely to put China on pace for the deepest hit to its economy in more than four decades.

Even now, China's economy remains in a fragile state of recovery, having lifted many of the restrictions but also enacting new ones, including tightened restrictions on international flights, in a bid to prevent a second wave of imported infections.

While China has shifted its economy toward domestic consumption in recent years, it remains heavily reliant on exports, which have faced a raft of challenges this year. Gnarled supply chains have prevented raw materials from reaching the factory floor, while domestic travel restrictions have blocked laborers from returning from the Lunar New Year holiday in late January.

Now, most worrying of all, China's customers in the U.S. and across the West are largely shut, and demand is likely to remain depressed for the foreseeable future.

"It's the biggest challenge to the Chinese and the world economy during peacetime in modern history," said Ding Shuang, head of greater China economic research at Standard Chartered. Unlike previous economic downturns, which developed gradually, Mr. Ding compared the coronavirus shock to "a sudden hit of the pause button."

Economists and analysts have been keeping close tabs on China's economic recovery. One economic research firm, Trivium China, estimates business activity has returned to roughly 83% capacity, up from roughly 70% a month ago but having largely flattened out at around the 80% level.

"That last 20% is going to be harder than all the progress made so far," Trivium's analysts wrote in a note to clients on Thursday.

Wang Tao, China economist for UBS, an investment bank, estimates that nonfarm employment likely fell by 78 million people in the first three months of the year -- 50 million to 60 million of them in the service sector and another 20 million in the industrial and construction sectors.

China's working-age labor force stood at roughly 900 million at the end of 2018, according to official figures.

Ms. Wang expects the labor market to recover as more workers find new jobs. Even so, she predicts nonfarm employment to fall by 14 million for the year, wiping more than two years' worth of overall job gains.

A first-quarter contraction puts Beijing deep in a hole at the beginning of a year that leaders had hoped would mark a triumphant year for the country. President Xi Jinping had set year-end goals of doubling overall GDP levels from a decade earlier and eliminating poverty -- all in the name of building what the leadership has called "a moderately prosperous society in all respects."

Economists say meeting that political goal requires China to notch full-year GDP growth of about 5.5%, which economists largely regarded as attainable before the coronavirus first emerged into public view in mid-January.

Getting to that level of growth for the full year would require the economy to ramp up quickly and more sharply through the rest of 2020.

Some economists have raised the possibility that China could break with tradition and drop its formal economic-growth target for this year. Mr. Tilton of Goldman Sachs says China could replace its economic growth target with an employment target. Standard Chartered's Mr. Ding suggested China could effectively write off the disastrous first quarter and set a growth target for the remaining three quarters of the year.

China's leaders typically set a formal economic-growth target at their annual leadership meetings in early March -- though this year's meetings have been postponed because of the coronavirus.

Dropping the formal target would give leaders more flexibility on economic policy during a year of unprecedented challenge, with smaller businesses at risk of failing and joblessness on the rise. Already, the country is expecting to graduate its largest class of college students in a decade.

Liyan Qi, Grace Zhu and Bingyan Wang contributed to this article.

Write to Jonathan Cheng at jonathan.cheng@wsj.com