China's exports grew at their fastest pace in five months in June, exceeding analysts' expectations and adding to evidence that the world's second-biggest economy is slowly recovering from the damage of pandemic restrictions.

However, imports rose at a slower pace, missing forecasts, despite the easing of limits on movement.

Despite the buoyant export growth, the country's trade outlook faces rising pressures in the second half of the year, as fading demand in key export markets, a protracted Ukraine war and high inflation fuel concerns about a global recession.

Outbound shipments in June were 17.9% higher than a year earlier, official customs data showed on Wednesday, compared with a 16.9% annual gain seen in May and quicker than analysts' expectations for a 12.0% rise.

While a weaker yuan and higher global prices bolstered shipment values, the quick resumption of industrial production in key manufacturing hubs and the recovery of port operations and logistics also helped, said Wen Bin, chief economist at Minsheng Bank.

Daily container throughput in June at Shanghai port, which had earlier been severely affected by a lockdown, had recovered to at least 95% of the same level a year earlier, according to official data.

Thanks to government stimulus measures and the lifting of lockdowns, China's economy entered an upswing 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 shook off three months of declines in June.

Wednesday's customs data showed June imports had inched up 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.

China posted a trade surplus of $97.94 billion last month, versus analysts' forecast for a $75.70 billion surplus and a $78.76 billion surplus in May.

Policymakers are doubling down on infrastructure spending to help recovery from damage inflicted by the anti-virus measures and other economic problems.

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 on Wednesday.

Also, 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.

China is due to release its second-quarter GDP data on Friday. Analysts say the official target of around 5.5% for this year will be hard to achieve without doing away with Beijing's strict zero-COVID strategy. (Reporting by Stella Qiu, Ellen Zhang and Ryan Woo; Editing by Bradley Perrett & Shri Navaratnam)