At least for now, a shutdown of the port of Boston and others East and Gulf coast ports has been averted after the International Longshoremen’s Association and the United States Maritime Alliance agreed to extend their contract for 30 days to continue negotiations.

Port workers had voted to strike on Sunday when the current contract expires, threatening a shutdown of major ports that would have disrupted the flow of goods and cost hundreds of millions of dollars in lost wages and economic activity.

Federal Mediation and Conciliation Service Director George Cohen announced Friday that both sides had agreed to an extension until midnight Jan. 28 to resolve outstanding issues in the master contract, including those relating to the ports of New York and New Jersey.

“The container royalty payment issue has been agreed upon in principle by the parties, subject to achieving an overall collective bargaining agreement," Cohen said in a statement.

Cohen declined to disclose details of the container royalty payment agreement. “What I can report is that the agreement on this important subject represents a major positive step toward achieving an overall collective bargaining agreement,” he said. “While some significant issues remain in contention, I am cautiously optimistic that they can be resolved in the upcoming 30-day extension period.”

Retailers welcomed the extension, though they said the lack of a finalized deal was still cause for concern.

"While a contract extension does not provide the level of certainty that retailers and other industries were looking for, it is a much better result than an East and Gulf Coast port strike that would have shut down 14 container ports from Maine to Texas,” National Retail Federation President and CEO Matthew Shay said in a statement. “A coast-wide port shutdown is not an option. It would have severe economic ramifications for the local, national and even global economies and wreak havoc on the supply chain.”

Massport officials had been making preparations for a strike, considering extending hours of operation to give shippers access to their cargo before the work stoppage occurred.

The Conley Container Terminal in Boston handles roughly 1.5 million tons of containerized cargo annually and supports about 1,000 jobs in the city, according to Massport.

While some governors and more than 100 businesses had written to President Barack Obama calling on the president to intervene and use his emergency powers to stop a walkout, aides to Gov. Deval Patrick said this week he was monitoring the situation and hopeful that a deal could be reached before Sunday.