The union representing Hollywood crews has reached an agreement on a new contract with the major studios, avoiding a historic strike next week that would have disrupted film and TV production nationwide.

The International Alliance of Theatrical Stage Employees and the Alliance of Motion Picture and Television Producers said they have concluded an agreement on a new three-year contract covering some 40,000 film and TV industry workers represented by 13 Hollywood union locals.

The alliance represents the major Hollywood studios such as Walt Disney and Warner Bros. along with newcomers Apple, Amazon and Netflix.

“This is a Hollywood ending,” IATSE International President Matthew Loeb said in a statement. “Our members stood firm. They’re tough and united. We went toe to toe with some of the richest and most powerful entertainment and tech companies in the world, and we have now reached an agreement with the AMPTP that meets our members’ needs.”

The agreement ends a standoff that would have led to the first nationwide strike in the union’s 128-year history and the first major strike by crews since World War II. IATSE had planned to begin a strike Monday if no deal was reached.

IATSE said the tentative contract, which is subject to approval by members, improves wages and working conditions for streaming productions, provides a retroactive wage increase of 3% annually and higher penalties for companies that don’t provide meal breaks. The agreement also has unspecified diversity, equity and inclusion initiatives and adds Martin Luther King Jr.'s birthday as a holiday, the union said.

The pact also includes a commitment to fund the union’s health and pension plans, which are facing a $400-million deficit, and addresses long-standing complaints about long hours on sets. It would require producers to provide a minimum turnaround time of 10 hours between daily shoots and 54 hours’ rest after a five-day week.

Variety first reported that a breakthrough in negotiations came after the sides worked late Friday night, with entertainment attorney Ken Ziffren and senior Disney executive Peter Rice playing important roles in bridging differences between the sides.

The deal was greeted with a sigh of relief across Hollywood, which was on edge over the prospect of a shutdown that would have upended planned film and TV shoots.

A walkout would have had a significant effect on the film and TV industry in Southern California and other production hubs nationwide, including New York, Atlanta, Chicago and Albuquerque. The last major labor dispute in Hollywood — the 2007-08 writers strike — lasted 100 days and sparked lasting changes to the industry.

Studios — still recovering from heavy losses caused by shutdowns and movie theater closures — have been eager to ramp up productions that were delayed by the COVID-19 pandemic.

The threatened walkout caught some studio executives by surprise.

IATSE, which represents camera operators, grips, prop makers, set dressers and decorators, makeup artists and many other specialized technical workers, historically has avoided public confrontations with studios. The union has traditionally preferred to quietly negotiate early agreements with their employers to avoid rocking the boat and keep their members working.

But this time around, the union’s leaders recognized they had substantial leverage against the studios.

They knew that traditional media companies were loath to endure another crippling production shutdown, potentially losing even more ground to rival Netflix and other streaming services.

Some of these same companies also have launched their own streaming services — WarnerMedia has HBO Max, NBCUniversal has Peacock and ViacomCBS has Paramount+ — and they desperately need original TV shows and movies to attract their own subscribers.

In addition, these same companies that own broadcast networks — CBS, NBC, ABC, the CW and Fox — have been trying to regain their footing during the current fall TV season.

The networks feared another work stoppage would contribute to further ratings declines by interrupting the production of popular shows such as CBS’ “Young Sheldon,” ABC’s “Dancing with the Stars” and “Jimmy Kimmel Live!” and NBC’s “The Voice.”

“The business is finally starting to crawl out of the hole that we’ve been in,” one network TV executive who was not authorized to speak publicly said last week. “A strike would not be good for anyone.”

With that recognition, IATSE leaders felt emboldened to take a tougher stand to secure better pay and working conditions on behalf of their members.

Crew members have been chafing under the endless days on set to keep pace with an onslaught of production currently underway to make TV shows and movies that will feed the various streaming services.

IATSE members said they have simply grown weary and frustrated working 16-hour days and weekends.

Support for a walkout was strong among union members, who voted nearly unanimously earlier this month to give their leaders authorization to call a strike if they couldn’t come to terms with the studio representatives.

“These gigantic companies have gotten comfortable pushing things — pushing, pushing,” Joe Holdman, 30, a lighting director and member of IATSE Local 728, told The Times last week. “This is one of those things that has been bubbling under the surface for so long, and it finally reached a tipping point.”

The strong show of support gave the union’s leaders considerable leverage to press their demands.

Studio executives acknowledged that it would be untenable to defend previous deal points that had enabled TV producers, directors and showrunners to keep crews working, in some cases, more than 15 hours a day.

USC history professor Steven J. Ross said the issues that IATSE has been pushing — better pay, safer conditions, shorter workweeks — “are the same issues that unions have been fighting for since the AFL, American Federation of Labor, was formed in the 1880s.”

Labor discord has been on the rise in the U.S. at a time when employers have struggled to fill open jobs.

In August, a record 4.3 million people quit their jobs, according to the federal government.

The breakthrough in the IATSE talks came two days after 10,000 John Deere & Co. workers went on strike after rejecting a contract proposal between the company and leaders of their United Auto Workers union. Last month, Nabisco employees staged a walkout for a week, protesting proposed changes to the length of their shifts and overtime rules.

On Monday, thousands of Kaiser Permanente workers in Southern California voted to authorize a strike against the healthcare giant, protesting what they describe as severe staffing shortages that put both the medical staff and patients at risk.

“You are seeing changes in labor patterns across America,” said Nithya Raman, a Los Angeles City Council member whose district includes parts of Hollywood. “It marks a real shift and I’m really glad that Hollywood is seeing a local echo of that same national shift in worker power.”

A contract between the AMPTP and IATSE for film and TV workers lapsed July 31 and was extended to Sept. 10 to allow more time for bargaining and to negotiate new COVID-19 safety protocols.

IATSE and the AMPTP, whose membership has grown increasingly diverse over the years, have sparred over a raft of issues.

The union was seeking improvements in wages and compensation from streaming productions that it believes are unfairly discounted. Another big sticking point involved complaints about long hours and lack of breaks for crews as producers have pushed to make up for production delays caused by the pandemic.