Japan's trade surplus expanded 9.3% in May from a year earlier to 389.5 billion yen ($3.16 billion), government data showed on Thursday.
The figure compared with analysts' median forecast of a 25.9% rise in the surplus to 448.5 billion yen.
Exports rose 15.1% from a year earlier to 6.5651 trillion yen, compared with economists' median forecast of an 11.1% rise, data from the Ministry of Finance showed.
Imports rose 15.5% to 6.1755 trillion yen, against the market consensus for a 10.5% increase.
Exports to the United States rose 0.4% from a year earlier to 1.3034 trillion yen, while those to China climbed 24.5% to 1.0346 trillion yen.
On a seasonally adjusted basis, the overall customs-cleared trade surplus decreased 26.5% from the previous month to 788.5 billion yen, the data showed.