A deal has been struck to avert a strike by Hollywood film and television writers, according to a union negotiator.
“Happy to report – we have a deal!” said Billy Ray of the Writers Guild of America on Twitter.
The agreement – which has yet to be officially confirmed – came after 01:00 in Los Angeles.
It follows marathon talks between the union and representatives of the big Hollywood studios.
They have been negotiating since 13 March.
A previous strike in 2007-08 is estimated to have cost the California economy more than $2bn.
Had the two sides not reached agreement, it could have lead to the first writers’ strike since then.
The Writers Guild of America (WGA) wanted higher pay per episode and royalties for reruns.
The writers’ union, which represents about 9,000 people, said its members have been squeezed, as studios commission shows with fewer episodes, but lock up writers with exclusive contracts.
The union also said writers were not sharing enough of the profits made from online streaming, which keeps shows and movies alive for years after first airing.
The union estimates the average salary for TV writer-producers fell 23% in the last two years.
It says its requests would add about $156m in costs for the major production companies, which include firms such as 21st Century Fox and Time Warner.
About 96% of more than 6,000 WGA members voted to strike last week. Some took to social media to express solidarity, changing pictures on Twitter to spotlight their support.
A strike would have first affected topical shows, such as Saturday Night Live, which have enjoyed higher ratings since the election of Donald Trump as President, who has proved an popular target for news satire.
The Alliance of Motion Picture and Television Producers, which represents conglomerates such as Comcast Corp, Walt Disney Co and CBS Corp, said last week it is “committed to reaching a deal … that keeps the industry working.”
At the time of the last writers’ strike, online television was in its infancy. Today, Amazon and Netflix are major competitors for eyeballs and have a deep reserve of programmes to buffer them from viewer demands for new content.