BEIJING (AP) — China’s politically volatile global trade surplus surged to $676.4 billion in 2021, likely the highest ever for any country, as exports jumped 29.9% over a year earlier despite semiconductor shortages that disrupted manufacturing.

The country’s monthly trade surplus in December swelled 20.8% over a year earlier to a record $94.4 billion, customs data showed Friday.

China piled up a series of monthly export surpluses in 2021 but they prompted less criticism from the United States and other trading partners than in earlier years while their governments focused on containing coronavirus infections.

Exports rose to $3.3 trillion in 2021 despite shortages of processor chips for smartphones and other goods as global demand rebounded from the coronavirus pandemic. Manufacturers also were hampered by power rationing in some areas to meet government efficiency targets.

The surplus with the United States, one of the irritants behind a lingering U.S.-Chinese trade war, rose 25.1% in 2021 over a year earlier to $396.6 billion. Trade envoys have talked since President Joe Biden took office in January but have yet to announce a date to resume face-to-face negotiations.

Exports to the United States gained 27.5% over 2020 to $576.1 billion despite tariff hikes by Biden’s predecessor, Donald Trump, that still are in place on many goods. Chinese imports of American goods rose 33.1% to $179.5 billion.

In December, China’s monthly trade surplus with the United States rose 31.1% over a year earlier to $39.2 billion. Exports to the U.S. market rose 21.1% to $56.4 billion while imports of American goods edged up 3.3% to $17.1 billion.

This month, China’s global export volumes are likely to weaken due to congestion at ports where anti-coronavirus restrictions are imposed and to changes in global demand as shippers clear backlogs, said Julian Evans-Pritchard of Capital Economics.

“We’d still bet on export volumes being lower rather than higher by the end of this year,” said Evans-Pritchard in a report.

Chinese imports in 2021 rose 30.1% to $2.7 trillion as the world’s second-largest recovery rebounded from the pandemic.

Economic growth weakened in the second half of the year as Beijing carried out a campaign to reduce what it sees as dangerously high debt in the real estate industry, but consumer spending was above pre-pandemic levels.

Manufacturing activity edged higher in December but new export orders contracted, according to survey earlier by the government statistics bureau and an industry group, the China Federation of Logistics & Purchasing.

Chinese exporters benefited from being allowed to resume most normal business in early 2020 while foreign competitors faced anti-coronavirus restrictions on travel and trade. That advantage carried into 2021 as other governments renewed controls in response to the spread of new virus variants.

Earlier, forecasters said Chinese exporters would benefit from the spread of the latest variant, omicron, which Beijing appeared to be keeping out of the country. More recently, however, China has responded to outbreaks within its own borders by imposing travel restrictions on major cities including Tianjin, a manufacturing center where omicron was found.

China’s global trade surplus was a 26.4% increase over 2020, which economists said then was among the highest ever reported by any economy. They said the only comparison as a percentage of the economy’s size likely was Saudi Arabia and other oil exporters during their price boom in the 1970s, but their total revenues were smaller.

The swollen trade surplus has strained the ability of China’s central bank to manage the exchange rate of its yuan, which has risen to multi-year highs against the U.S. dollar as money flows into the country. The People’s Bank of China has tried to limit the ability of banks and other traders to speculate on the currency’s movement.

China’s trade surplus with the 27-nation European Union, its second-largest trading partner, swelled 57.4% in 2021 over a year earlier to $208.4 billion. Exports to the EU rose 32.6% to $518.3 billion while imports of European goods gained 19.8% to $309.9 billion.

In December, China’s trade surplus with Europe widened by 85.9% over a year earlier to $25.1 billion.