Analysts say the rebound in exports reflected an easing of supply chain disruptions and port congestion that hammered the world's second-largest economy in spring when the government rolled out widespread lockdowns.
Outbound shipments in June rose 17.9% from a year earlier, the fastest growth since January, official customs data showed on Wednesday, compared with a 16.9% gain in May and much more than analysts' expectations for a 12.0% rise.
"This jump reflects the easing of supply chain disruptions coming out of lockdowns and, most importantly, fewer bottlenecks at ports," said Julian Evans-Pritchard, senior China economist at Capital Economics.
"Although total container throughput at Chinese ports was little changed last month, the recent weakness of domestic shipping demand has freed up more port capacity for foreign trade," he said.
Daily container throughput in June at Shanghai port, which had been severely affected by a lockdown, had recovered to at least 95% of year-earlier levels, according to official data.
Exports of computers, steel products and autos contributed to the robust growth. China exported 248,000 vehicles in June, up 30.5% from a year earlier.
However, economists say the strength in exports is likely to fade as rising global interest rates to rein in inflation begin to sap demand and broader economic growth.
The threat of further pandemic restrictions at home also hangs over Chinese businesses and households, while the Ukraine war has put renewed pressure on world supply chains and raised exporters' operating costs.
China's foreign trade still faces instability and uncertainty, said Li Kuiwen, a spokesman for the General Administration of Customs, at a news conference in Beijing.
Zhiwei Zhang, chief economist at Pinpoint Asset Management, said that while foreign trade continued to be the "best performing engine of the economy," the outlook points to "a bumpy road with disruptions."
"As the demand in the developed countries shifts towards services from goods, the strong export growth may not be sustainable in the second half of the year. The current (COVID)outbreak in Shanghai and some other cities again cast uncertainty to the economic recovery in Q3," Zhang added.
Thanks to government stimulus measures and the lifting of lockdowns, China's economy began to regain some traction last month. It suffered a severe slump in April as the country grappled with its biggest COVID-19 outbreak since 2020.
Official and private surveys show the country's factory activity improved in June after three months of declines, while the services sector staged an impressive rebound.
Slowing imports, however, raised questions about the strength of the recovery.
June imports inched up just 1.0% from a year earlier, slowing from May's 4.1% gain, weighed down by the lockdown-induced slackening in commodity imports and subdued domestic consumption. Analysts had forecast a 3.9% rise.
Evans-Pritchard noted that import volumes dived to a three-year low last month, indicating continued weakness in China's construction sector, usually a significant growth driver.
Almost all of China's commodity imports were notably weaker. Daily crude oil imports in June fell 11% from a year earlier to their lowest since July 2018, while coal imports fell 33%.
Soybean imports also fell 23% from a year earlier as high global prices curbed demand for the oilseed.
But Iris Pang, chief economist for Greater China at ING, said demand for imports should have recovered mildly as the calculated Chinese demand for goods before shipments was affected by lockdowns and port congestion between April and May. She expected imports to rebound, if there are no more prolonged lockdowns in key Chinese cities.
China posted a trade surplus of $97.94 billion last month, a record high, versus analysts' forecast for a $75.70 billion surplus and a $78.76 billion surplus in May.
Total export value surprised to the upside, resulting in the record-high and stronger-than-expected trade surplus, analysts at Goldman Sachs said in a note.
Data on Friday is expected to show further signs of economic improvement, though modest, with June industrial output picking up and retail sales levelling out after months of contraction.
But growth for the second quarter as a whole likely slowed sharply, and possibly even contracted from the first quarter, suggesting policymakers will have to do much more to spur activity.
Even then, economists are doubtful that gross domestic product growth will meet the government's target of around 5.5% target for this year, unless it relaxes its strict zero-COVID strategy.
While pressure builds from a softening global backdrop, China's key property market remains shaky and soft consumer spending at home mean its traditional engines of growth also remain underpowered. A renewed push on infrastructure spending will take time to get into gear.
Adding to the headwinds, the highly transmissible BA.5 Omicron sub-variant has been found in several cities over the past week.
As of Monday, 31 cities - making up 17.5% of China's population and 25.5% of GDP - have implemented full or partial lockdowns or some control measures at district level, Nomura analysts said in a note.