BEIJING — The coronavirus outbreak has brought China’s extraordinary, nearly half-century-long run of growth to an end — a stark reminder of the enormous task ahead for world leaders trying to restart the global economy.

Chinese officials on Friday said that the world’s second-largest economy shrank 6.8 percent in the first three months of the year compared with a year ago, ending a streak of untrammeled growth that survived the Tiananmen Square crackdown, the SARS epidemic and even the global financial crisis. The data reflects China’s drastic efforts to stamp out the coronavirus, which included shutting down most factories and offices in January and February as the outbreak sickened tens of thousands of people.

The stark numbers make clear how monumental the challenge of getting the global economy back on its feet will be. Since it emerged from abject poverty and isolation more than 40 years ago, China has become perhaps the world’s single most important growth engine, one that lifted fortunes during previous times of trouble, like the financial crisis.

Now China is trying to restart its vast, $14 trillion economy, an effort that could give the rest of the world a much-needed shot in the arm. The coronavirus’s spread to the United States and Europe, which froze the economies there, has led to forecasts that the world’s output could shrink far more this year than it did even during the financial crisis.