Only about 600 clerical workers were on strike, but when other International Longshore and Warehouse Union workers refused to cross picket lines, it shut down 10 of the 14 shipping container terminals at the two ports.
A deal was struck Tuesday after a federal mediator got involved.
The Port of Long Beach estimates $650 million in trade has been idled each day of the strike.
"The retail community is pleased to see a settlement of the strike," said National Retail Federation President and CEO Matthew Shay.
"Our attention now shifts to the East and Gulf Coast ports, where federal mediators have been locked in prolonged discussions with labor and management for the past two months.
"We urge the parties to reach a final agreement before their contract extension ends at the end of December. Retailers, manufacturers and the rest of the business community cannot afford another shutdown."
11/30/2012 Strike Slows Intermodal Traffic at LA-Area Ports
8/28/2012 Labor and Management Asked to Resume Port Contract Talks
9/21/2012 East Coast/Gulf Coast Port Strike Averted