A tentative agreement has headed off a strike at the nation's largest commuter railroad.

New York Gov. Andrew Cuomo, who became personally involved in talks between the Metropolitan Transportation Authority and unions representing Long Island Rail Road workers, announced Thursday that a deal had been reached, three days ahead of a planned strike.

The 5,400 LIRR employees had been working without a contract since 2010.

"This is a compromise by both parties after four long years," Cuomo said.

Cuomo brought the two sides back to the table on Wednesday after talks appeared to falter.

"For much of the week, labor leaders suggested a strike was all but certain on the railroad, which accounts for about 300,000 rider trips on weekdays," The New York Times reports.

Details of the bargain were not announced. Talks had continued through the night, and labor and management came to an agreement Thursday at the governor's Manhattan office.

"MTA chairman Thomas Prendergast and lead LIRR union negotiator Anthony Simon agreed that the contract was fair and reasonable," Newsday reports.

Federal mediators had sided with the unions in recent months, but the MTA rejected two different sets of nonbinding recommendations.

The MTA had recently proposed offering a 17 percent raise spread over seven years, while asking workers for concessions on pensions and health care. The unions wanted 17 percent raises over six years.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.