UPDATED: The WGA and AMPTP closed in on a deal early Tuesday, averting the threat of a writers strike that could have begun today.

The sides came to terms shortly after midnight after a marathon day of negotiations that began around 11 a.m. PT. The talks were rocky for most of the day, with sources reporting pessimism about the prospect of the sides reaching a deal just two hours before the midnight PT deadline of the previous contract.

This round of WGA-AMPTP talks marked the most contentious labor talks in Hollywood in a decade, since the WGA last went on strike for 100 days starting Nov. 5, 2007. The increasing threat of a strike spurred engagement by the CEOs of the major conglomerates in the Alliance of Motion Picture and Television Producers. It also rallied WGA members around the union with a show of solidarity that allowed the guild to push for significant changes in compensation structures and other issues that address the financial pressures writers are facing amid the vast expansion of TV production.

Read the guild’s memo to members below.

Your Negotiating Committee is pleased to report that we have reached a tentative agreement with the AMPTP that we can recommend for ratification.

In it, we made gains in minimums across the board – as well as contribution increases to our Health Plan that should ensure its solvency for years to come. And we further expanded our protections in Options and Exclusivity.

We also made unprecedented gains on the issue of short seasons in television, winning a definition (which has never before existed in our MBA) of 2.4 weeks of work for each episodic fee. Any work beyond that span will now require additional payment for hundreds of writer-producers.

We won a 15% increase in Pay TV residuals, roughly $15 million in increases in High-Budget SVOD residuals, and, for the first time ever, residuals for comedy-variety writers in Pay TV.

And, also for the first time ever, job protection on Parental Leave.

Did we get everything we wanted? No. Everything we deserve? Certainly not. But because we had the near-unanimous backing of you and your fellow writers, we were able to achieve a deal that will net this Guild’s members $130 million more, over the life of the contract, than the pattern we were expected to accept.

That result, and that resolve, is a testament to you, your courage, and your faith in us as your representatives.

We will, of course, provide more details in the next few days. But until then, we just wanted to thank you – and congratulate you. Your voices were indeed heard.

PREVIOUSLY: Negotiations between the WGA and AMPTP are ongoing as the midnight contract expiration deadline has passed. Earlier in the night, there were cautious reports of movement on key issues. And there were no immediate indications of a strike being called on the websites of the WGA West or WGA East.

There’s speculation that a short-term contract extension could be in the works if both sides feel they are gaining ground. The prospect of an extension could not be confirmed, as both sides are adhering to a media blackout. The WGA has vowed to strike on Tuesday if some kind of deal is not reached by tonight.

PREVIOUSLY: Sources reported little progress in contract negotiations between the Writers Guild of America and major studios on Monday as the sides face a midnight PT deadline to cut a deal or set a short-term extension agreement that would avert a strike. As of late afternoon, the sides were still huddled at the Alliance of Motion Picture and Television Producers headquarters in Sherman Oaks.

The WGA opened Monday’s meeting at around 11 a.m. PT with the guild’s response to several offers that were put on the table on Sunday by the Alliance of Motion Picture and Television Producers. Sources said the studios felt the WGA’s counter represented little movement from its previous position on issue of span, or extra compensation for writers working on short order series.

AMPTP leaders have been frustrated by what they characterize as the WGA’s lack of prioritization of its issues and lack of give-and-take in hammering out the terms. WGA sources dispute that, asserting that the guild has given the studios plenty of feedback but management is balking at the WGA’s resolve on key issues. Another source close to the situation offered a more hopeful assessment the day so far, suggesting that saber-rattling on both sides would eventually give way to a deal.

Sources said there had been no discussion today of a short-term extension to give the sides more breathing room as the midnight PT deadline approaches, but insiders acknowledged that such a move remains a possibility.

It’s understood that sticking points at present include the issue of parity for script fees and scale payments across broadcast, cable and SVOD outlets and whether executive producers should receive extra compensation for working longer than two weeks per episode on short-order series.

The AMPTP has proposed a short-order formula that narrowly targets lower- and middle-run writer positions in an effort to address the drop in income that writers are facing with the industry’s migration to series that run 6-13 episodes per season instead of the traditional broadcast standard of 22-24 episodes per season.

The down to the wire talks evoke the tension in the room a decade ago when the WGA and AMPTP were at loggerheads, leading to a 100-day strike. In November 2007, however, there was some confusion about what time the contract deadline expired for the WGA West and WGA East, given the time zone difference. When the WGA East declared itself on strike at 12:01 a.m. ET on Nov. 5, AMPTP negotiators furiously called off the talks.

This time around, it’s believed to be understood that the contract deadline is midnight PT for both guilds.