Economists polled by Reuters had expected China to post an overall trade surplus of $20.5 billion in May.
The larger trade surplus came as the country's dollar-denominated exports surprisingly increased last month, while imports came in worse than expected. China's General Administration of Customs said on Monday that exports in May inched up 1.1% year-on-year, while imports fell 8.5% during the same period.
Economists in the Reuters poll had forecast both exports and imports to fall 3.8% year-on-year in May.
In April, China's overall trade surplus in April was $13.8 billion, far below the projected $35 billion. That's partly due to an unexpected rise of 4% in imports, and a surprise fall of 2.7% in exports for the month.
Meanwhile, China's trade surplus with the U.S. rose to $26.89 billion in May from $21.01 billion in April, Chinese customs data showed.
The large trade imbalance between the two countries has been one of U.S. President Donald Trump's stated goals in applying elevated tariffs on American imports from China. But high-level negotiations between the U.S. and China stalled after the president last month raised tariffs on $200 billion worth of Chinese goods, claiming that Beijing "broke the deal" in talks.
Trump threatened that more levies could come — a point reiterated by U.S. Treasury Secretary Steven Mnuchin, who told CNBC the president "is perfectly happy" to increase tariffs on China if his expected meeting with Chinese President Xi Jinping doesn't go well. Trump said that he's expected to meet Xi later this month.
Many analysts expect China to experience a larger economic hit from its ongoing trade war, with data in recent months showing signs of slowing activity. The International Monetary Fund and major banks such as Morgan Stanley recently lowered their growth forecasts for China citing trade concerns.
But the latest employment data in the U.S. — which showed weaker than expected jobs creation — put the two countries on roughly equal footing, said Johanna Chua, head of Asia economics and market analysis at Citi.
Chua told CNBC's "Street Signs" after the latest Chinese data release that the U.S. jobs data may be the first sign that the American economy is getting hit by the escalation in trade tensions.
"For now, both sides — from an economic standpoint — have a lot to gain from doing a deal. But I think from the politics side, it's actually getting tougher," she said.
— Reuters contributed to this report.