(Adds details on China, shipments to USA, imports)

* March exports rise slower than expected year-over-year

* Imports gain more than expected year-over-year

* March trade deficit 412.4 billion yen

TOKYO, April 20 (Reuters) – Japan posted a trade deficit for the eighth straight month in March as soaring energy and commodity prices raised the cost of imports, deepening the country’s economic woes following of the Ukrainian crisis.

Exports rose less than expected as growth in shipments to major trading partner China slowed, data showed on Wednesday, suggesting the economy continues to face risks from global supply constraints and to the coronavirus pandemic.

Imports soared 31.2% on the year to March, Finance Ministry data showed on Wednesday, above median market forecasts for a 28.9% gain in a Reuters poll.

That topped a 14.7% year-on-year increase in exports last month, resulting in a trade deficit of 412.4 billion yen ($3.19 billion), which was higher than the 100.8 billion deficit. yen expected in a Reuters poll.

While the March deficit marked the eighth consecutive month of year-on-year deficits, it was the narrowest gap in five months.

By region, exports to China, Japan’s largest trading partner, rose 2.9% in the 12 months to March on stronger shipments of electronic projectors to the country, a growth weaker than the 25.8% jump of the previous month.

Exports to the United States, the world’s largest economy, rose 23.8% in March, on stronger shipments of auto parts and power-generating machinery.

Imports were mainly boosted by larger shipments of oil from the United Arab Emirates and coal and liquefied natural gas from Australia, the data showed.

Japan’s economy is expected to grow 4.9% annualized in the current quarter on the back of a pickup in consumer activity after the government ended measures to combat the coronavirus pandemic last month.

But a rapid weakening of the yen, which has slid to its lowest level in two decades against the dollar on the prospect of widening interest rate differentials between the United States and Japan, is inflating the costs of already rising imports of fuel and food. ($1 = 129.1800 yen) (Reporting by Daniel Leussink; Editing by Christopher Cushing)