The U.S. merchandise-trade deficit narrowed to the smallest in three months in July as imports fell from the highest on record.

The gap decreased to $86.4 billion from a revised $92.1 billion in June, according to Commerce Department data released Friday. That was smaller than all estimates in a Bloomberg survey of economists.

Imports declined 1.4% to $233.9 billion, led by a drop in the value of inward-bound shipments of consumer goods. The only category to increase from the prior month was automotive vehicles.

The pause in growth in imports comes as Americans rein in spending on purchases and shift their preference toward services as vaccinations enabled people to engage in activities less accessible earlier in the pandemic.

Exports climbed for a fifth straight month, advancing 1.5% to a record $147.6 billion. Gains were broad-based and were led by categories such as capital goods, autos and consumer goods.

Wholesale inventories climbed 0.6%, while retail inventories increased 0.4%.

Overall, the value of U.S. exports plus imports fell from June’s record to $381.5 billion.

The July trade picture will come into greater focus when the final report, which includes services, is released on Sept. 2.