LOS ANGELES — Work resumed Wednesday at the nation’s busiest port complex after a crippling strike was settled, ending an eight-day walk-off that affected thousands of jobs and billions of dollars in cargo.

Gates at the Los Angeles and Long Beach harbors reopened, and dockworkers were ready to resume loading and unloading ships that had been stuck for days, Los Angeles port spokesman Phillip Sanfield said.

“It’s going to take a few days, maybe a week or two to get back to normal,” Long Beach port spokesman Art Wong said.

Dozens of ships were stuck idle at the complex or delayed on their way in, officials said. Auto parts, retail merchandise for January sales and repair parts for Redbox video kiosks were among the items that could be late in getting to their destinations around the country, Wong said.

Television reports showed huge cargo vessels moving into port, and a line of trucks waiting to enter a terminal.

Clerical workers who said that shippers were outsourcing their jobs struck on Nov. 27 and thousands of dockworkers in the same union refused to cross picket lines, paralyzing much of the port complex that handles 44 percent of all container cargo that arrives by sea nationwide, including items such as cars from Japan and computers from China.

Negotiators reached a tentative agreement to end the strike late Tuesday, two hours after federal mediators arrived from Washington, D.C.

The union said the proposed contract between clerical workers and 14 shipping terminal operators contained new protections against outsourcing of their well-paid jobs out of state and overseas. Clerical workers are expected to ratify the deal in the next week or two.

The key provision prohibits companies from cutting the local workforce by more than 14 positions through the June 2016 life of the contract. Companies also must fill vacant positions when workers are absent for vacations or other reasons, although in certain cases they can wait about a month.

The companies had argued that previous rules requiring them to fill positions, even when the workload didn’t justify it, amounted to union featherbedding.

However, “compromise is necessary to get people back to work,” said Steve Getzug of the Los Angeles/Long Beach Harbor Employers Association, which is representing management.

Port officials estimated that roughly $760 million worth of cargo a day failed to move through the ports during the walkout. Some 20 ships diverted to other ports in California and Mexico while others scheduled to reach Southern California simply didn’t sail.

A full account of all of the goods affected was not immediately available; holiday items had arrived weeks ago.

Days of negotiations that included all-night bargaining sessions suddenly went from a stalemate to big leaps of progress by Tuesday. Mayor Antonio Villaraigosa said the sides were already prepared to take a vote when the mediators arrived.

The strike began when 450 members of the ILWU’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 different units of the same union, refused to cross picket lines.

Even though the deal was reached soon after their arrival, the federal mediators said they had little to do with the solution.

“In the final analysis, it worked. The parties reached their own agreement,” said George Cohen, director of the Federal Mediation and Conciliation Service. “There is no question in my mind that collective bargaining is the best example of industrial democracy in action.”

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.”

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.

Villaraigosa, who had been calling for the two sides to reach a deal for days, said he was pleased by the resolution.

“I think it’s appropriate to say ‘mission accomplished,’” he said.

PROPOSED LA PORT CONTRACT

Here are key provisions of the proposed contract between clerical workers and 14 shippers that ended an eight-day strike at the Los Angeles and Long Beach ports:

• Companies can reduce the number of local clerical positions by no more than one position per company through June 2016, the life of the contract.

• Positions left vacant when clerical workers are on vacation or otherwise absent must be filled in a day. Exceptions are when workers are absent for funerals, medical leave or because of disability. Those absences must be covered after 31 days.

• Workers, who currently make an average base salary of $87,000 a year, will receive salary increases of $1 per year through 2013, with additional hikes unspecified but possible later in the contract. Those increases also are likely to be $1 per year.

• Pension benefits will increase from the current $150 per year of service to $170 per year of service over the life of the contract.

• Health care benefits will be unchanged.

• Employees will receive several thousand dollars in bonus pay because they have worked without a contract since June 2010.