Agreement has been reached to end the eight-day strike that crippled the largest port complex in the US, the Mayor of Los Angeles announced this morning.

Mayor Antonio Villaraigosa said federal mediators from Washington DC had helped broker a tentative agreement reached during Tuesday night.

"The negotiating team has voted to approve a contract that they’ll take to their members," he said.

"I think it’s appropriate to say ’mission accomplished’."

The mayor also confirmed that the shipping authorities would not outsource staff – a key issue in talks with port employers that have been going on for around two years.

Workers will return to work today, a union official confirmed.

"I’m really pleased to tell all of you that my 10,000 longshore workers in the ports of LA and Long Beach are going to start moving cargo," said Ray Familathe,VP of the International Longshore and Warehouse Union, which also represents about 800 clerks.

“This victory was accomplished because of support from the entire ILWU family in the harbour community,” said ILWU International President Robert McEllrath, who praised the unity and solidarity of members, their families and thousands of community supporters.

Familathe added: “Our campaign was always focused on securing good jobs and stopping the outsourcing that threatened working families in our harbour communities.”

Port clerks working at the APM Terminals-operated Pier 400 at LA went on strike at noon last Tuesday. At almost 200ha, it is the biggest and busiest cargo terminal in the Americas for containerised freight.

The walkout quickly closed 10 of the two ports’ 14 terminals when around 10,000 dockworkers, members of the clerks’ sister union, refused to cross picket lines.

ILWU Local 63-OCU President John Fageaux thanked union members for “ having the courage to stand against powerful employers in order to protect good jobs into the future”.

He added: “This was a community effort that will benefit working families for many years to come.”

The agreement will not be finalised, however, until union members have voted.

Together, the ports of Los Angeles and Long Beach handle about 44% of all cargo that arrives in the US by sea. The cargo stacked up on the docks and in adjacent rail yards or, in many cases, remained on arriving ships. Some of those ships were diverted to other ports along the west coast.

Estimates from management and retailers are that the strike was costing the US economy up to $1 billion a day. Tens of thousands of truckers, railroad, warehouse and other support workers were also temporarily out of work because the strike has stopped the flow of goods they normally handle.

Over the weekend, customers of the shipping lines, including major retailers, asked President Obama to intervene and seek a court order forcing the clerks back to work during an mediated cooling off period.