Japan's current account surplus shrank 12.9 percent from a year earlier to ¥577.3 billion in July, due mainly to skyrocketing import costs driven by the government's weakening of the yen, government data said Monday.

The surplus in the balance of international payments, one of the widest gauges of trade for a country, dropped despite a rise in direct investment income.

The goods trade balance logged a deficit of ¥943.3 billion, the biggest deficit for a July since comparable data became available in 1985, the Finance Ministry said in a preliminary report.

Imports grew 21.0 percent to ¥6.6505 trillion, outweighing growth in exports.

Import costs have been rising on increased demand for natural gas and oil from power companies now dependent on fossil fuel-based power generation following the nation's departure from atomic power after the Fukushima meltdowns in March 2011.

Exports rose 11.5 percent to ¥5.7073 trillion due mainly to higher shipments of autos.

But the current account balance logged a surplus for a sixth month, driven by growth in direct investment income, which more than offset the trade deficit.

The income account, which reflects how much Japan earns from its foreign investments, stood at a surplus of ¥1.7938 trillion, up 24.2 percent, the highest for a July since 1985.

Takeshi Minami, chief economist at Norinchukin Research Institute, said the goods trade deficit will likely narrow down the road as the global economy heals, with demand for imported natural gas and oil not expected to grow sharply.

The current account balance "is likely to maintain a surplus" for the time being, Minami said.