* Labor dispute cost Southern California about $8 billion
* Union, mayor say accord addresses outsourcing concerns
* Walkout was region's worst cargo disruption in 10 years
By Dan Whitecomb and Steve Gorman
LOS ANGELES, Dec 4 (Reuters) - Striking harbor clerks reached a tentative deal with management at the ports of Los Angeles and Long Beach on Tuesday night, settling an eight-day labor clash that has idled most of America's biggest cargo-shipping complex.
The strike cost Southern California, a region still struggling to recover from a prolonged economic slump, an estimated $8 billion, including lost wages and the value of cargo rerouted to other ports over the past week.
It marked the worst cargo traffic disruption at Los Angeles and Long Beach - which together account for nearly 40 percent of all U.S. container imports - since a 10-day lockout of longshoremen at several West Coast ports in 2002.
Tuesday's accord followed a resumption of talks with last-minute prodding from Los Angeles Mayor Anthony Villaraigosa, a onetime labor activist, who announced the deal moments after union negotiators voted to approve it.
Federal mediators called in to join negotiations at the mayor's behest earlier in the day showed up just as the settlement was being reached.
Officials for the International Longshore and Warehouse Workers (ILWU) Local 63 said the hundreds of clerical employees who walked off the job last Tuesday, and the thousands of longshoremen who had refused to cross their picket lines, would return to work starting Wednesday morning.
The mood was jubilant outside the waterfront community center where talks were held, as smiling union members embraced and clapped one another on the back.
Union officials said they expected the rank and file, who have been without a contract for more than two years, to ratify the new agreement. Details of the pact were not made public.
But the mayor and ILWU representatives said the two sides had come to terms on the union's chief concern - control over outsourcing, or the transfer of jobs to workers elsewhere for less pay.
Under the agreement, Villaraigosa told Reuters: "The employers are not going to outsource."
Union spokesman Craig Merrilees said: "Really it was getting control on the outsourcing ... ensuring that the jobs are here today, tomorrow and for the future."
Stephen Berry, chief negotiator for the Harbor Employees Association, representing shippers and terminal operators at the talks, hailed the settlement as "the end of a very long journey. We're delighted with the terms. We'll be operating again and the cargo will be flowing."
During the dispute, the employers had accused union negotiators of seeking to "featherbed" the ranks of clerical workers with more jobs than were necessary.
CARGO SHIP DIVERSIONS WORRIED TERMINAL OWNERS
With support from some 10,000 longshoremen and other union workers who honored picket lines, t he strike by the 800-member clerical workers unit of the ILWU local forced a shutdown at 10 of the twin ports' 14 container terminals.
Four other container terminals remained open, along with facilities for handling shipments of automobiles, liquid fuels and break-bulk cargo such as raw steel.
The latest strike prompted at least 18 freighters to change course and take their cargo to ports in Northern California, Mexico and Panama, according to the non-profit Maritime Exchange of Southern California. T h e diverted cargo heightened concerns about the region losing business to competing ports.
An additional 13 cargo-laden ships were lined up at anchorages outside the Los Angeles-Long Beach complex on Tuesday, waiting to unload their containers, the exchange said.
Unlike the labor clash at West Coast ports a decade ago, which took place in the fall, the latest dispute unfolded after the busy pre-holiday shipping season, limiting the scope of its ripple effect.
Many major U.S. retailers said they were largely spared any pain from the labor clash b ecause most of their Christmas inventory had already made it to store shelves.
But the National Retail Federation asked President Barack Obama last week to intervene, warning a prolonged strike could have a "devastating impact on the U.S. economy."
The ports of Los Angeles and Long Beach together handled more than $400 billion in goods arriving or leaving the West Coast by ship last year. Experts say the ports directly or indirectly support 1.2 million Southern California jobs - workers involved in moving freight to or from the shipping complex.