The deficit was 517.4 billion yen ($6.5 billion) in July, according to provisional trade figures. That compares with a 69.7 billion yen surplus a year earlier and a modest surplus of 62 million yen in June of this year.
Exports fell 8 per cent from a year earlier in July to 5.3 trillion yen ($66.9 billion), while imports rose 2 per cent to 5.83 trillion yen ($73.6 billion), the ministry said.
Japan has managed to eke out small trade surpluses in some months over the last year, but reported a record annual trade deficit for the fiscal year that ended in March.
The strong Japanese yen has hurt exports, as have disruptions caused by last year's earthquake and tsunami disaster in northeastern Japan, which hampered production of autos and electronics.
Exports have also suffered from weaker European demand due to the debt crisis.
A look at the figures for July shows sharp drops in exports of consumer electronics, customarily a mainstay for Japan's economy.
Total exports to Western Europe plunged 28 per cent in July from a year earlier, while exports to the rest of Asia fell 9 per cent. Exports to North America rose 5 per cent, and those to the Middle East rose 9 per cent.
Japan posted its biggest half-year trade deficit ever in January-June — 2.9 trillion yen ($37.4 billion) — as exports weakened and fuel imports soared to keep power going despite shutdowns of most of the country's nuclear reactors.
All but two of Japan's 50 working reactors remain offline after the nuclear crisis set off in March 2011 by a massive earthquake and tsunami, leaving the country more reliant than in the past on imported oil, gas and coal to supply electricity.
Japan's imports of liquefied natural gas jumped 24 per cent from a year earlier in July, while imports of power generating machinery rose 39 per cent.
Power conservation efforts have boosted sales of electric fans and bamboo sunshades, most made in China, as families switch off air conditioners while trying to beat the heat, the Japan External Trade Organization reported.