China's exports and imports both fell in May as the coronavirus and trade tensions with the U.S. weighed on demand both at home and abroad.

Exports fell 3.3% compared to a year earlier to $206.8 billion and imports dropped 16.7%to $143.9 billion, the Chinese customs agency said Sunday.

The plunge in imports drove the country's trade surplus up to $62.9 billion. The surplus with the United States reached $27.9 billion.

People wearing face masks to protect against the new coronavirus walk at a government event aiming to stimulate consumer demand and consumption in Beijing, Saturday, June 6, 2020. China's capital is lowering its emergency response level to the second-lowest starting Saturday for the coronavirus pandemic. That will lift most restrictions on people traveling to Beijing from Wuhan and surrounding Hubei province, where the virus first appeared late last year. (AP PhotoMark Schiefelbein)

People wearing face masks to protect against the new coronavirus walk at a government event aiming to stimulate consumer demand and consumption in Beijing, Saturday, June 6, 2020. China's capital is lowering its emergency response level to the second-lowest starting Saturday for the coronavirus pandemic. That will lift most restrictions on people traveling to Beijing from Wuhan and surrounding Hubei province, where the virus first appeared late last year. (AP PhotoMark Schiefelbein)

The fall in exports came after a surprise 3.5% rise the previous month. Exports to the U.S. totaled $37. 2 billion, while imports from the U.S. were $9.3 billion.

Analysts were expecting the decline in exports, attributing April's rise to orders placed before virus restrictions hit overseas economies and predicting that American and European customers would likely cancel other orders.

People wearing face masks to protect against the new coronavirus browse merchant tents at a government event aiming to stimulate consumer demand and consumption in Beijing, Saturday, June 6, 2020. China's capital is lowering its emergency response level to the second-lowest starting Saturday for the coronavirus pandemic. That will lift most restrictions on people traveling to Beijing from Wuhan and surrounding Hubei province, where the virus first appeared late last year. (AP PhotoMark Schiefelbein)

People wearing face masks to protect against the new coronavirus browse merchant tents at a government event aiming to stimulate consumer demand and consumption in Beijing, Saturday, June 6, 2020. China's capital is lowering its emergency response level to the second-lowest starting Saturday for the coronavirus pandemic. That will lift most restrictions on people traveling to Beijing from Wuhan and surrounding Hubei province, where the virus first appeared late last year. (AP PhotoMark Schiefelbein)