Unions and management reached a tentative deal early Thursday, averting a freight rail strike that had threatened to cripple U.S. supply chains and push prices higher for many goods.   

  The agreement with unions representing more than 50,000 engineers and conductors was announced shortly after 5am.  ET in a statement from the White House, which called it “an important victory for our economy and the American people.”   

  It came after 20 hours of talks between union leadership and railroad labor negotiators hosted by Labor Secretary Marty Walsh.  They began their meeting Wednesday morning with the clock ticking down for a strike that was set to begin at 12:01 a.m.  ET on Friday.   

  President Joe Biden personally called to speak with negotiators around 9 p.m.  ET Wednesday, according to a person familiar with the negotiations.  Biden stressed that there could be catastrophic damage to families, businesses and communities if the rail system is shut down.   

  The agreement does not mean that the threat of a strike has completely disappeared.  The agreement must be ratified by union members.  But it’s good news for a wide range of businesses that depend on freight railroads to keep operating, and for the broader U.S. economy.  About 30% of the country’s freight transport is carried by rail.   

  The deal gives union members an immediate 14 percent raise with back pay dating back to 2020 and a total of 24 percent raises over the five-year contract, which runs from 2020 to 2024. It also gives them a cash bonus of 1,000 $ per year.   

  Few other details of the deal have been released so far.  But Biden’s statement showed that the major issue that had brought the country within a day of the first national railroad strike in 30 years had been dealt with in favor of unions.   

  “It’s a victory for tens of thousands of railroad workers who have worked tirelessly during the pandemic to ensure that America’s families and communities receive what has kept us going through these difficult years,” Biden said in a statement.  “These railroad workers will get better pay, improved working conditions and peace of mind about health care costs: all hard-earned things.”   

  The dispute centered on staffing shortages and scheduling rules that union leaders said had brought their membership to a breaking point.  Unions say the railroads require their members to be “on call” and ready to report to work at short notice for up to seven days a week.  The leadership of the two unions had said their members would not accept a contract without changes to those work rules.   

  Biden described the deal as “also a win for railroad companies that will be able to retain and hire more workers for an industry that will continue to be part of the backbone of the American economy for decades to come.”   

  It’s a major win for Biden, who faced nothing but bad options if no deal was reached.  Supporting congressional action by the business community to force a contract on workers would have angered his supporters among unions.  Allowing the work stoppage to continue carries the risk of huge economic consequences just before the midterm elections.   

  Railroad workers are governed by different labor laws than most workers, which limits their freedom to strike and allows for greater government intervention.  In July, Biden issued an order that prevented a strike at the time and created a committee, known as the President’s Emergency Council, to try to find a solution to the dispute.   

  It also imposed a 60-day cooling-off period during which unions could not strike and management could not lock out workers.  This relaxation period was to end early on Friday.   

  Biden could not have ordered the railroads to resume operations once the relaxation period ended on Friday.  Only Congress could have acted to put unions back to work if a strike had begun.   

  With a wide range of business groups calling on Congress to act, Republicans had prepared legislation that would give the railroads the deal they wanted.  But Democrats opposed such action.   

  A union source said Democrats’ refusal to side with the administration was key to the talks.   

  “Senate leadership not acting made room for these negotiations,” the union source said.  He said Walsh had “stuck” with the union during negotiations.   

  “It was a slog yesterday,” he said, with a lot of back and forth.   

  “Our people were not going to give up,” the source said.  “Our people would have gone on strike” if no deal had been reached by Friday’s deadline.   

  The Union of American Railroads also praised the deal and thanked the Biden administration, as well as the unions themselves, for their role in reaching an agreement.   

  The wage and bonus increases had been recommended by a presidential commission tasked with trying to find a solution to the impasse in negotiations at the time.   

  Those terms were lucrative enough for most railroad unions to agree to tentative deals in recent weeks, with engineers and conductors, faced with work and scheduling rules that didn’t apply to others, refusing to sign without relief on the scheduling issue.   

  Shares of major freight railroads — Union Pacific ( UNP ), CSX ( CSX ) and Norfolk Southern ( NSC ) — were between 1% and 3% higher in premarket trading on the news.  Shares of Berkshire Hathaway ( BRKA ), which owns the nation’s fourth largest freight railroad, Burlington Northern Santa Fe, were also marginally higher.