The Office for National Statistics said that Britain's goods trade gap narrowed to £7.401bn from £8.028bn in May, a bigger fall than the drop to £7.8bn analysts had forecast.
The goods trade gap with non-EU countries narrowed to £4.262bn from £4.492bn, broadly as expected.
Britain's trade performance has been disappointing for much of the past year as sterling's slide since 2007 has failed to offset weaker demand from Britain's trading partners.
Goods exports to non-EU countries were the highest on record at £10.750bn and exports to the world as a whole were the highest since July 2008 at £22.444bn.
The improvement in the global goods trade deficit was driven by stronger oil and chemical exports and reduced imports of cars.
The ONS said the value of goods exports rose 4.3 per cent on the month, while the value of goods imports rose one per cent.