By Agence France-Presse
The world's third-largest economy registered a surplus of 3.4 billion yen ($32 million) in February, after booking a deficit the previous month, according to the finance ministry.
Japan's surplus with the United States edged up 3.4 percent on increased exports in automobiles.
That could increase friction between Tokyo and Washington as President Donald Trump steps up his protectionist trade policies.
According to a report in the Washington Post last week, Trump claimed in a fundraising speech that Japan was using unreasonable testing standards to keep out US auto companies.
"They take a bowling ball from 20 feet up in the air and they drop it on the hood of the car," Trump reportedly said, in inaccurate comments that were greeted with bemusement and mockery in Japan.
Japan's total exports edged up 1.8 percent from a year earlier to 6.463 trillion yen but imports also rose 16.5 percent to 6.460 trillion yen.
The yen was on average 3.7 percent higher against the dollar compared to the same month a year earlier.
Still, exports in automobiles grew 15.7 percent, contributing to the surplus in February.
Japan booked its 12th consecutive monthly deficit of 425 billion yen with China as imports of clothes surged 55.2 percent.