Japan logged its second largest ever monthly goods trade deficit of 2.38 trillion yen ($17.7 billion) in May, remaining in the red for the 10th consecutive month mainly due to high commodity prices, the Finance Ministry said Thursday.

The trade deficit in May widened from 839.2 billion in the previous month and was the second largest after a 2.80 trillion yen deficit recorded in January 2014, according to the ministry.

The value of imports increased 48.9 percent to 9.64 trillion yen, shattering the highest figure on record for the third consecutive month, while exports rose 15.8 percent from a year earlier to 7.25 trillion yen for the 15th straight month of increase, the ministry said in a provisional report.

Imports were boosted by higher prices of energy resources, such as petroleum from the United Arab Emirates, coal from Australia, and liquefied natural gas from Australia and Malaysia, a ministry official said.

Photo shows liquified natural gas tanks at Inpex Corp.'s onshore processing facility in Darwin, Australia. (Kyodo) ==Kyodo

Driven by rising energy prices resulting from Russia's invasion of Ukraine, imports of petroleum rose in value for the 14th consecutive month to 1.07 trillion yen and increased in terms of volume for the seventh straight month to 12.2 million kiloliters.

Sanctions that Japan has imposed against Moscow over its aggression, in line with other Group of Seven nations, dented import volumes of mineral fuels from Russia such as petroleum, coal and LNG. Still, the value was up 65.2 percent from a year earlier at 111.3 billion yen reflecting rising energy prices, according to the ministry.

Exports rose on the back of brisk iron and steel shipping, refined fuel products such as fuel oil to Singapore, and semiconductor components, the official said.

Kazuma Kishikawa, an economist at Daiwa Institute of Research, said the supply chain disruptions caused by measures against the coronavirus pandemic remain in some countries such as China, which implemented a lockdown in Shanghai, keeping exporters from boosting production by capitalizing on a weaker yen.

Manufacturers also failed to keep pace with a rise in input costs, he added.

Among such sectors, auto exports to China dropped 36.3 percent in the reporting month and those of chip-making devices decreased 9.7 percent from a year earlier, both by value.

"If supply-side constraints ease, the trade deficit (for Japan) will be narrowed," Kishikawa said.