For the first time in a long time, the Port of New York and New Jersey ranked No. 2 in the U.S. by volume shipped from January through May. The Port of Long Beach in California for a while has been the country's second-busiest port behind its close neighbor, the Port of Los Angeles.

In terms of loaded 20-foot equivalent units—also known as TEUs, a standard measure of shipping volume—imports and exports going through New York Harbor increased by 4.3% over the same five-month periods of 2018 and 2019. Long Beach's TEU volume, in contrast, decreased 9%.

With only five months of data reported for 2019, Long Beach could reclaim its No. 2 ranking by the end of the year. New York's lead at the close of May was just 4%. And historically, Long Beach's import and export volumes have peaked in July, August and October, so its shipping volume could well rally past New York's in the second half of this year. But Port Authority officials said it has been decades since New York was busier in the first part of the year.

On the downside for the Southern California port, the shipping industry is navigating new market forces, notably the trade war between the U.S. and China. Each country has imposed tariffs on billions of dollars' worth of products. From the West Coast, Long Beach is more vulnerable to fluctuation in shipping volume with countries in western Asia. Although Presidents Donald Trump and Xi Jinping have agreed not to impose further tariffs for the time being as the two countries discuss a trade deal, the tariff battle doesn't have an end in sight.

The trade war isn't the only driving force behind the ranking flip between New York and Long Beach. The raising of the Bayonne Bridge, which was completed in 2017, has allowed large Panamax shipping vessels to reach the ports of Newark and Elizabeth in New Jersey and Howland Hook Marine Terminal in Staten Island. New York's railways also provide an edge, said Sam Ruda, port director at the Port Authority of New York and New Jersey.

"The rate of growth in rail on the West Coast has slowed," he said. "It's much more economically viable to go through the East Coast. It's a function of rail economics."

Ruda added, "That's not just a New York phenomenon. I think competing ports to the south would say the same thing." Those ports include Norfolk, Va.; Savannah, Ga.; and Charleston, S.C.