PANAMA CITY — Fireworks exploded as a huge container ship made an inaugural passage through the newly expanded Panama Canal on Sunday, formally launching the Central American nation’s multibillion-dollar bet on a bright economic future despite tough times for global shipping.

After passing through the Atlantic locks at Agua Clara under a cloudy sky in the early morning in the northern province of Colon, the Chinese-owned Cosco Shipping Panama, carrying some 9,000 cargo containers, entered the Cocoli locks near the capital in the afternoon to complete its journey to the Pacific Ocean stewarded by tugboats.

The $5.25 billion project went online nearly two years late after construction delays, labor strife and apparent cost overruns, but officials were still bullish and in a celebratory mood.

“This is the route that unites the world,” Panamanian President Juan Carlos Varela said.

“This new transit route is the tip of the iceberg in making Panama once again the logistics center of the Americas,” canal administrator Jorge Luis Quijano said. “And it represents a significant opportunity for the countries of the region to improve their infrastructure, increase their exports.”

Crowds that began gathering before dawn lined both sides of the canal waving flags, partying to salsa music and watching videos on giant screens. Authorities said about 30,000 people and eight foreign heads of state were attending.

“It’s a one-time experience, a great achievement,” said Felicia Penuela, a homemaker from Colon province. “Panama is showing the world that even though it is a small country it can do great things.”

The Cosco Shipping Panama is a 158-foot-wide, 984-foot-long behemoth that is one of the modern New Panamax class of mega-vessels that are seen as the future of global shipping and will now be able to use the canal.

The waterway’s capacity doubles with the new locks, and canal authorities are hoping to better compete with the Suez Canal in Egypt and tap new markets such as natural gas shipments between the United States and Asia.

“The Panama Canal, with this expansion, is an important player not only for regional maritime commerce but worldwide,” said Oscar Bazan, the Panama Canal Authority’s executive vice president for planning and commercial development. “The canal is a winning bet.”

Authorities said Sunday said that 85 percent of the 166 reserved crossings scheduled for the next three months are for container ships. Container cargo accounts for nearly 50 percent of the canal’s overall income.

Panamanians at the ceremony expressed hope that the expansion will help the economy in a country where about 25 percent of the people live in poverty.

“I think the inauguration of the locks is excellent for the current generations and those to come,” said Moises Gonzalez, a 40-year-old mechanic who worked on the construction of the locks for six years. “Opportunities for us. We have to find a way for it to reach the people.”

However, the party comes amid a lull in global shipping because of the drop in oil prices, an economic slowdown in China, which is the canal’s second-largest customer, and other factors that have hit the waterway’s traffic and income.

Authorities anticipate increasing commerce between Asia and ports on the U.S. East Coast, but it’s not clear that not all those ports are ready to handle the huge New Panamex-class cargo ships.