Workers load a container onto a truck at a port in Tokyo

Japan's trade deficit has narrowed to a nine-month low in March, as exports rose higher than analysts' expectations and the weakness of the yen gave the country's product a competitive advantage in international markets.

Japan's ministry of finance said that the country's trade shortfall declined to 362.4 billion yen ($3.7bn) in March from 777.5 billion yen in February. The deficit was the smallest since a small surplus recorded last June.

Overall exports rose 1.1 percent in March from a year earlier to 6.3 trillion yen, beating analysts' expectations of a 0.2 percent increase. Imports, primarily in the energy sector, were up 5.5 percent to 6.6 trillion yen.

The US has overtaken China as Japan's biggest export destination. Japan's exports to China fell 9 percent to 11.3 trillion yen, while exports to the US increased 10 percent to 11.4 trillion yen.

Big-ticket orders from the US revived and shipments of transport equipment and machinery contributed largely to the year-on-year increase in exports.

The yen's weakness against the US dollar particularly made Japanese products cheaper for US consumers. Japanese Prime Minister Shinzo Abe has been pushing for a decline in the yen's value against other major currencies to help Japanese exporters. The yen has fallen about 19 percent against the dollar in the past six months, trading at 98.08 as at 6:15 am GMT.

Trade between China and Japan suffered from a slowdown in China and a political row between Tokyo and Beijing over a chain of islands in the East China Sea.

Japanese exports to the rest of Asia fell almost 42 percent and shipments to the European Union dropped 14 percent.

Nevertheless, the weaker yen also means higher import costs for the country. Imports of natural gas to the country have been on the rise since the closure of almost all nuclear plants following the 2011 earthquake. Fuel import costs that represent over a third of total imports rose 6.6 percent, with natural gas costs up 15 percent and crude oil costs up 5.3 percent.

The rising import costs have resulted in the country posting a trade deficit for a long time. Despite being narrower on a monthly basis, the trade deficit was four times bigger than a year earlier.

Japan's overall trade deficit was at 8.2 trillion yen for the fiscal year ended in March, the widest figure on record.

Nevertheless, the country's current account remains positive with the inflows of earnings from overseas investments by Japanese firms.