LOS ANGELES (AP) — Negotiators reached an agreement late Tuesday to end an eight-day strike that crippled the nation's largest port complex and prevented shippers from delivering billions of dollars in cargo to warehouses and distribution centers across the country, the mayor of Los Angeles said.

Mayor Antonio Villaraigosa emerged from the talks to make the announcement just a few hours after he had escorted in the federal mediators who had just arrived from Washington.

"The negotiating team has voted to approve a contract that they'll take to their members," Villaraigosa said, flanked by smiling negotiators, union members and the two mediators.

The deal came after days of negotiations that included all-night bargaining sessions suddenly went from a stalemate to big leaps of progress. Villaraigosa said the sides were already prepared to take a vote when the mediators arrived.

The strike began Nov. 27 when about 400 members of the International Longshore and Warehouse Union's local clerical workers unit walked off their jobs. The clerks had been working without a contract for more than two years.

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

At issue during the lengthy negotiations was the union's contention that terminal operators wanted to outsource future clerical jobs out of state and overseas — an allegation the shippers denied.

Shippers said they wanted the flexibility not to fill jobs that were no longer needed as clerks quit or retired. They said they promised the current clerks lifetime employment.

During the strike, both sides said salaries, vacation, pensions and other benefits were not a major issue.

The clerks, who make an average base salary of $87,000 a year, have some of the best-paying blue-collar jobs in the nation. When vacation, pension and other benefits are factored in, the employers said, their annual compensation package reached $165,000 a year.

"We know we're blessed," one of the strikers, Trinnie Thompson, said during the walkout. "We're very thankful for our jobs. We just want to keep them."

Union leaders said if future jobs were not kept at the ports, the result would be another section of the U.S. economy taking a serious economic hit so that huge corporations could increase their profit margins by exploiting people in other states and countries who would be forced to work for less.

After the tentative deal was announced, the workers' union released a statement thanking members for supporting the strike.

"This victory was accomplished because of support from the entire ILWU family of 10,000 members in the harbor community," said Robert McEllrath, the international president of the International Longshore & Warehouse Union.

Combined, the Los Angeles and Long Beach ports handle about 44 percent of all cargo that arrives in the U.S. by sea. About $1 billion a day in merchandise, including cars from Japan and computers from China, flow past its docks.

Shuttering 10 of the ports' 14 terminals kept about $760 million a day in cargo from being delivered, according to port officials. 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.

The clerks handle such tasks as filing invoices and billing notices, arranging dock visits by customs inspectors, and ensuring that cargo moves off the dock quickly and gets where it's supposed to go.

The $1 billion a day in cargo that moves through the busy port terminals is loaded on trucks and trains that take it to warehouses and distribution centers across the country.

Earlier on HuffPost:

Loading Slideshow...
  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Members of International Longshore and Warehouse Union Local 63 Office Clerical Unit walk a picket line near APM Terminals, halting cargo at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002, which prompted President George W. Bush to intervene with a court injunction to resolve the standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Members of International Longshore and Warehouse Union Local 63 Office Clerical Unit walk a picket line near APM Terminals, halting cargo at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002, which prompted President George W. Bush to intervene with a court injunction to resolve the standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Members of International Longshore and Warehouse Union Local 63 Office Clerical Unit walk a picket line near APM Terminals, halting cargo at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002, which prompted President George W. Bush to intervene with a court injunction to resolve the standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Members of International Longshore and Warehouse Union Local 63 Office Clerical Unit walk a picket line near APM Terminals, halting cargo at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002, which prompted President George W. Bush to intervene with a court injunction to resolve the standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Members of International Longshore and Warehouse Union Local 63 Office Clerical Unit walk a picket line near APM Terminals, halting cargo at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002, which prompted President George W. Bush to intervene with a court injunction to resolve the standoff. (Photo by David McNew/Getty Images)

  • Striking protestors are shown at the Port of Los Angeles Wednesday Nov. 28, 2012 in Los Angeles. Striking workers shut down the largest terminal at the Port of Los Angeles for a second day on Wednesday, ignoring an arbitrator's order to return to work and raising the possibility of a larger job action that could paralyze the nation's busiest port complex. (AP Photo/Nick Ut)

  • Striking protestors are shown at the Port of Los Angeles Wednesday Nov. 28, 2012 in Los Angeles. Striking workers shut down the largest terminal at the Port of Los Angeles for a second day on Wednesday, ignoring an arbitrator's order to return to work and raising the possibility of a larger job action that could paralyze the nation's busiest port complex. (AP Photo/Nick Ut)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Shipping container trucks sit in traffic as the International Longshore and Warehouse Union strikes, putting a halt to most of the work at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002 when President George W. Bush intervened with a court injunction to resolve the labor standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: The APM shipyard stands idle after members of International Longshore and Warehouse Union Local 63 Office Clerical Unit walked off the job at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002, which prompted President George W. Bush to intervene with a court injunction to resolve the standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Dock cranes appear to be idle as the International Longshore and Warehouse Union strikes, putting a halt to most of the work at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002 when President George W. Bush intervened with a court injunction to resolve the labor standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: Shipping container trucks sit in traffic as the International Longshore and Warehouse Union strikes, putting a halt to most of the work at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002 when President George W. Bush intervened with a court injunction to resolve the labor standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    LONG BEACH, CA - NOVEMBER 29: A harbor police officer redirects shipping container trucks caught in a traffic jam as the International Longshore and Warehouse Union strikes, putting a halt to most of the work at the busiest seaport complex in the nation on November 29, 2012 in Long Beach, California. The strike is the largest work stoppage at the ports of Los Angeles and Long Beach since a lockout by shipping companies in 2002 when President George W. Bush intervened with a court injunction to resolve the labor standoff. (Photo by David McNew/Getty Images)

  • Workers At Southern California Ports Go On Strike

    SEAL BEACH, CA - NOVEMBER 29: A container ship anchored offshore from the Seal Beach Pier is one of several that cannot enter the ports of Los Angeles and Long Beach to load and unload cargo because of a strike by the International Longshore and Warehouse Union Local on November 29, 2012 in Seal Beach, California. The strike is the largest work stoppage at the ports since a lockout by shipping companies in 2002, which prompted President George W. Bush to intervene with a court injunction to resolve the standoff. (Photo by David McNew/Getty Images)