Spain's trade deficit narrowed 45% in the first eight months of 2023 from the same period a year earlier, to 25.76 billion euros ($27.15 billion) as it imported less oil and natural gas, the country's industry ministry said on Thursday.

Imports over the period fell 5.4% to 282.33 billion euros, while exports rose 1.8% to 256.57 billion euros, the ministry said.

The value of energy imports, mainly oil and natural gas, fell 32% in the first eight months of the year compared with the same period a year ago as Spain bought 18% less in volume at prices 16% cheaper.

Other imports during the period rose 1.4% from the same period a year ago.

In August alone, the trade deficit shrank 10.4% to 4.44 billion euros.

Spain's trade deficit sky-rocketed in 2022 as oil and natural gas prices soared following the Russian invasion of Ukraine. Spain relies entirely on imports for its oil and gas.

($1 = 0.9489 euros) (Reporting by Tiago Brandao, editing by Inti Landauro and Deborah Kyvrikosaios)