Shipping containers are stacked on a ship docked at Yusen Terminals on Terminal Island at the Port of Los Angeles in Los Angeles, January 30, 2019.

LOS ANGELES — America's top two busiest container ports, the Los Angeles and Long Beach, on Tuesday reported declines in export volumes in May amid an ongoing trade war with China. For LA, it marks the port's 7th straight month of declines in exports.

The Port of Long Beach meanwhile registered a 19.5% decline in imports in May, which economists suggested may reflect big-box retailer concerns about inventory levels.

"The best we can say right now is that importers — at least through the Southern California ports — were concerned probably more about the size of the inventories right now than with anything else," said Jock O'Connell, a California-based international trade advisor for Beacon Economics. "Having already brought in vast numbers of commodities in anticipation of previous tariffs, they are pretty well stocked up."

According to O'Connell, some retailers have simply run out of room to store new goods. The LA and Long Beach port complexes together handle about 40% of the nation's containerized import trade with China.

The trade war boosted demand for what was already tight market conditions for warehouse space in the Southern California region, as U.S. retailers sped up the import of goods from Asia's largest economy to avoid new tariffs and ensure they have adequate supplies for the winter holidays.

"The warehouse and distribution centers in Southern California and ports themselves are just so stocked up (with) imports that were brought in previously, that there's no place to put them," the economist said.

Last week, the National Retail Federation indicated stores were loading up on goods to beat the Trump administration's threat to impose new tariffs on $300 billion worth of Chinese goods. On Monday, President Donald Trump renewed his threat to levy the duties if President Xi Jinping is not at this month's G-20 meeting.

"With a major tariff increase already announced and the possibility that tariffs could be impose of nearly all goods and inputs from China, retailers are continuing to stock up while they can to protect their customers as much as possible against the price increase that will follow," Jonathan Gold, NRF's vice president for supply chain and customs policy said last week.

The world's two largest economies have been locked in a trade war since Washington slapped tariffs on imported steel and aluminum from China in March 2018, which led Beijing to retaliate with its own duties on American products. The latest round of tariffs imposed by the administration took effect last month on $200 billion worth of Chinese imports.

In May, the Port of LA reported import volumes increased by 5.5% from a year ago, which contrasted with the double-digit decline in import volume at the adjacent Long Beach port facility. However, when import volumes for both LA and Long Beach were combined (as some economists prefer to measure it), there was a 7% decline in total imports.

Still, some experts suggested the import rise by LA may partly reflect shipments from Vietnam, which has been a beneficiary of trade as more manufacturers move production away from China.

As for exports, the Port of LA showed a dip of nearly 1% in May after registering a 6% drop in April. The nation's busiest seaport has posted declines in exports since November 2018, according to its data.

LA port officials didn't break out May's volumes by country of origin but a spokesman said China typically accounts for about 60% of the trade volume coming in and out of the massive complex.

"As we prepare for our traditional peak shipping season in the months ahead, we're closely monitoring global trade tensions that have created heightened unpredictability," Port of LA Executive Director Gene Seroka said Tuesday.

Overall, the Port of LA reported container volumes up nearly 8% to 828,662 TEUs, or 20-foot equivalent units, for May. But that total figure was lifted by a 20% surge in the number of empty containers that were returned to overseas ports such as China.

"We still have this imbalance of cargo, exacerbated by the trade war," said Phillip Sanfield, a spokesman for the Port of LA. He said the port sent about one third more empty containers overseas than it did loaded containers during the month of May.

To put that into perspective, the Port of LA handled about 9.5 million TEUs in all of 2018. TEUs are a common measure of shipping container volumes.

— Graphic by CNBC's John Schoen.