The US merchandise-trade deficit narrowed in May to its smallest this year as exports rose to a record, suggesting a tailwind for economic growth in the second quarter.

The shortfall shrank 2.2% to $104.3 billion last month, Commerce Department data showed Tuesday. The figures, which aren’t adjusted for inflation, compared with a median estimate for a gap of $104.8 billion in a Bloomberg survey of economists.

Exports rose 1.2% to $176.6 billion, while imports were little changed.

Aggressive lockdowns by the Chinese government to curb the spread of Covid-19 that saw imports plunge in April started easing a month later, illustrating an otherwise complicated near-term trade picture. Beijing’s measures—coupled with Russia’s war in Ukraine—have strained already-tenuous global supply chains.

US retailers and manufacturers have stepped up efforts to build up stockpiles amid the uncertainties in logistics networks to ensure they’re able to meet robust demand. The risk, however, is that sales of merchandise weaken more than forecast as some consumers spend more on services.

Imports of consumer goods have fallen from a record earlier this year, they remain well higher than the pre-pandemic average.

Retail inventories rose 1.1% in May to $705.3 billion from a month earlier as companies stock up on merchandise amid still-uncertain supply chains. Stockpiles at wholesalers climbed 2%.

The US’s busiest container-handling ports of Los Angeles and neighboring Long Beach on the West Coast moved near-record cargo volumes in May. The directors forecast strong cargo arrivals for June and July as retailers look to avert future supply-chain snarls to ensure seasonal goods specific to the second half of the year—such as back-to-school items—arrive in time.

In the first quarter, the widening of the trade deficit largely explains the economy’s worst performance since the pandemic recovery began, with gross domestic product shrinking an annualized 1.5%. Since the start of the second quarter, the trade gap has narrowed substantially.

Exports were boosted by gains in industrial supplies such as petroleum products, as well as increases in the value of shipments of consumer goods and motor vehicles.

US merchandise imports eased 0.1% in May from the prior month to $280.9 billion. Inbound shipments of consumer goods dropped 2.4%, while imports of industrial supplies rose 2.2%.

More complete May trade figures that include the balance on services will be released on July 7.