Italy's global trade balance swung to a surplus in the first six months of the year from a deficit in the same period of 2022, driven by sales in markets beyond the European Union (EU), official statistics agency ISTAT said on Friday.

Italy's overall surplus from January to June came in at 18.3 billion euros ($20.1 billion), a sharp turnaround from a deficit of 15.0 billion euros in the same period of 2022, data showed.

The country's balance with states outside of the EU totaled 26.2 billion euros in the first six months of 2023, reversing a deficit of 13.2 billion euros in the first semester of 2022.

Trade with fellow EU members resulted in a deficit of 7.9 billion euros, denting the overall trade balance.

An increase in exports of pharmaceutical and chemical products towards the United States and Switzerland helped Italy to post a trade surplus with the rest of the world of 7.72 billion euros in June. It registered a deficit of 1.73 billion with EU states in the month.

Exports in June rose 1.0% year-on-year , while imports fell 16.9%, ISTAT said.

The energy deficit dwindled to 3.9 billion euros in June, compared to a shortfall of 9.3 billion euros in the same month last year, as oil and natural gas imports from Russia and OPEC countries shrank.

($1 = 0.9096 euros) (Reporting by Alberto Chiumento, Enrico Sciacovelli, editing by Antonella Cinelli and Keith Weir)