Container is loaded onto a flatbed truck

Japan's trade deficit narrowed sharply last month as exports of automobiles and electronic parts picked up while a sky-high energy import bill continues to fall, finance ministry data showed Thursday.

The country's trade deficit came in at 69.0 billion yen ($556 million), plunging 91.7 percent from a 834.0 billion yen deficit a year ago, and offering some good news for an economy struggling to gain traction.

In June, the value of imports jumped 9.5 percent while imports were down 2.9 percent.

Over the six months through June the deficit shrank 77.4 percent as weak commodity prices helped bring down Japan's energy bill, which soared after it had to replace nuclear power in the aftermath of the Fukushima nuclear crisis.

Oil prices fell Wednesday after US government data showed higher crude stockpiles -- cheaper energy is generally good news for resource-poor Japan

"Exports will gradually regain strength toward the second half of this year,” said Akiyoshi Takumori, an economist at Sumitomo Mitsui Asset Management.

"External demand will support the economy."

Japan's exports to the key North American market were up 16.9 percent over the first half of the year, 5.1 percent to European Union countries while exports to China rose a less robust 2.2 percent since January, the data showed.

But export volumes barely budged and there are fears about a slowdown in China, a major trading partner with Japan.

“China will continue to pose a risk to Japan’s economy," said Atsushi Takeda, an economist at Itochu Corp.

Japan's central bank this month cut its annual growth and inflation forecasts for the world's third-largest economy, with analysts warning weaknesses remained and the downgrade hinted at a disappointing second quarter.

The economy expanded 1.0 percent in January-March after limping out of recession in the last three months of 2014, and business confidence remains strong.

But consumer spending has struggled after a sales tax rise last year and economists widely expect the Bank of Japan to ramp up its monetary easing programme, likely later this year, to bring Japan closer to its inflation target.

The target is a cornerstone of Prime Minister Shinzo Abe's drive to conquer years of stagnant or falling prices and revive the economy.

Marcel Thieliant from Capital Economics warned that the beneficial impact of falling gas and oil prices on Japan's trade balance was running out of steam as the yen continues to weaken against the dollar.

"The decline in gas prices, which follow crude oil prices with a lag of around six months, has now run its course," Thieliant said in a commentary.

"We expect the yen to weaken further against the dollar in coming months... The trade deficit should creep higher in the second half of 2015."