TOKYO -- Japan's trade deficit widened to its largest level in five months in July, as exports slowed thanks to faltering demand in China and other key markets, and imports fell by less than forecast.

The 268.1 billion yen ($2.2 billion) deficit reported Wednesday compared with a deficit of 70.5 billion yen ($566 million) in June. Exports rose 7.6 per cent to 6.7 trillion yen ($53.5 billion) while imports fell 3.2 per cent to 6.9 trillion yen ($55.7 billion).

Lower costs for imports of oil and gas have reduced Japan's trade deficit in recent months, and the deficit in July was 72 per cent lower than in the same month a year earlier. However, imports have not fallen as much as expected, with weakness in the yen countering that trend.

China's recent move to devalue the yuan, making its own products more price competitive in overseas markets, has further deepened unease over the trade outlook.

Exports to China rose 4.2 per cent from a year earlier, while shipments to the U.S. jumped 18.8 per cent, helped by a 41 per cent jump in exports of vehicles and parts.

Japan's imports from the Middle East fell 40.5 per cent as the value of imports of oil, gas and other fuels fell by about a third.

The economy contracted at a 1.6 per cent annual pace in April-June after a 4.5 per cent expansion in the first three months of the year, confounding hopes for a stronger recovery. While weak domestic demand was the biggest hindrance, exports also were a drag on growth.