The U.S. merchandise trade gap unexpectedly narrowed in June for the first time in four months as exports jumped by the most on record, signaling the pace of global commerce is stabilizing.

The overall balance shrank to $70.6 billion last month from $75.3 billion, Commerce Department data showed Wednesday. The median projection in a Bloomberg survey of economists called for a $75.4 billion shortfall in June. Exports surged 13.9% from May to $102.6 billion, and imports increased 4.8% to $173.2 billion.

While the total value of U.S. two-way trade picked up to $275.8 billion, it’s still well below the pre-pandemic peak as the world struggles to recover from the health crisis. At the same time, American exporters may stand to benefit from a recent decline in the value of the dollar, which makes U.S. goods more competitive in overseas markets.

The historic monthly gain in exports was led by more global demand for two of the biggest dollar-value categories. Industrial supplies, such as oil, rose 9.6% and capital goods, which include factory machinery and parts, jumped 11%. Motor vehicle shipments also surged as domestic auto production ramped back up.

The only category that declined was foods, beverages, and animal feed. While exports surged in June, they’re still down 24% from a year ago.

On the imports side, though, industrial supplies dropped nearly 20% from a month earlier. That was more than offset by gains in capital goods, cars, and consumer merchandise. Imports are still off 13.5% from June 2019.

The lower year-over-year levels are “another piece of evidence that suggests a prolonged recovery relative to the rapid decline in activity,” Katherine Judge, an economist at Canadian Imperial Bank of Commerce, said in a note. “Moreover, the re-tightening of social distancing in many states as virus cases surge could have led to a deterioration in two-way trade in July.”

The report also showed that wholesale stockpiles fell 2% during the month, while retail inventories dropped 2.6%. Both provide some indication of what companies expect consumer and business demand for products will be in months to come.