The total trade deficit - which includes services - widened to its highest in almost five years.
The deficit on goods and services rose to £4.9bn, against £3.9bn in June, the Office for National Statistics said.
The goods deficit was £8.7bn, against £7.5bn a month earlier, the biggest deficit since figures began in 1998.
However, trade in services produced a surplus of £3.8bn.
Imports increased by 3.1% on the month in value terms, which was largely driven by an increase in imports of organic chemicals, pharmaceuticals and oil. Exports including chemicals and oil fell by 0.9%.