Exports increased by £2bn, lifted by machinery and transport orders, while imports decreased by £1.8bn, the Office for National Statistics (ONS) said.
The ONS also made large revisions to trade figures for the period between January 2015 and September 2016.
It said it had made an error in the way it had recorded trade in gold.
September’s deficit was revised to £5.8bn from £5.2bn previously, while the deficit for the third quarter of the year widened to £14.9bn from the previous estimate of £11bn.
‘Big disappointment’
Scott Bowman, economist at Capital Economics, said: “While the monthly data are extremely volatile, the narrowing in the trade deficit in October sets a solid base for trade in the fourth quarter.
“What’s more, trade should be further supported in the coming months by the fall in sterling seen since the EU referendum, which should improve exporters’ competitiveness and encourage domestic production at the expense of imports.”
However, Chris Williamson from IHS Markit pointed out that “the big disappointment” was the fact that export volumes fell by 2.1% in October, while imports rose by 4.4%.
“Given the steep fall in sterling, one would have expected this to be the other way round, with exports rising and imports falling,” he said.
The pound has fallen sharply since the UK’s vote to leave the EU. Against a basket of currencies, sterling was 5.1% lower in October on average than in the previous month and 18.5% lower than a year earlier, the ONS said.
“Following the EU referendum, the UK trade deficit widened in the third quarter of 2016 and then in October it narrowed again,” said ONS statistician Hannah Finselbach.
“There remains only limited evidence so far that the depreciation of sterling has led to a marked increase in UK exports.”
Construction fall
Exports to the EU rose by £0.2bn last month, led by sales in the Republic of Ireland and the Netherlands. Separate figures from the ONS showed that construction output fell in October, down 0.6% compared with September.
Kate Davies from the ONS said: “October saw the biggest jump in private house building for almost a year though less work on commercial buildings and infrastructure projects saw overall construction output down on the month.
“Meanwhile, new construction orders fell in the third quarter, thanks mainly to a large fall in orders for public projects such as schools and hospitals.”
Join GhanaStar.com to receive daily email alerts of breaking news in Ghana. GhanaStar.com is your source for all Ghana News. Get the latest Ghana news, breaking news, sports, politics, entertainment and more about Ghana, Africa and beyond.