A Union Pacific rail car is parked at the CP Rail Toronto Yard in Scarborough
A Union Pacific rail car is parked at the Canadian Pacific Railway (CP Rail) Toronto Yard in Scarborough, Ontario, Canada March 20, 2022. Reuters

Major U.S. railroads and unions secured a tentative deal after 20 hours of intense talks brokered by the Biden administration to avert a rail shutdown that could have hit food and fuel supplies nationwide.

U.S. President Joe Biden announced the deal in a statement early Thursday morning, calling it "a win for tens of thousands of rail workers who worked tirelessly through the pandemic to ensure that America's families and communities got deliveries of what have kept us going during these difficult years."

The tentative deal now goes to the unions to be voted on, according to a person familiar with the negotiations.

Even if those votes fail, a rail shutdown that could have happened as soon as midnight Friday has been averted for several weeks due to the standard language included in such a deal, this person said.

A rail shutdown could freeze almost 30% of U.S. cargo shipments by weight, stoke inflation, cost the U.S. economy as much as $2 billion per day and unleash a cascade of transport woes affecting the U.S. energy, agriculture, manufacturing, healthcare and retail sectors.

Biden administration officials hosted labor contract talks into the night on Wednesday aiming to secure an agreement between unions which represent 115,000 workers and railroads including Union Pacific, BNSF, CSX, Norfolk Southern and Kansas City Southern.

Shares of U.S. railroad operators rose between 2.4% and 2.9% in pre-market trade.

Negotiations between the companies and a dozen unions had stretched for more than two years, leading Biden to appoint an emergency board to help break the impasse.

Biden himself called U.S. Labor Secretary Marty Walsh and negotiators around 9 p.m. on Wednesday to advance talks, according to a person aware of the negotiations, which lasted 20 hours.

Failing to reach a deal before the deadline of one minute after midnight on Friday would have cleared the way for workers to legally strike.

The railroad companies involved have cut jobs and trimmed pay and other costs in recent years as they increased profits, stock buybacks and dividends for investors. Profits at billionaire Warren Buffett's Berkshire Hathaway, which owns BNSF, rose 9.2% in the most recent quarter to $1.7 billion.

The number of U.S. railway workers has dropped from over 600,000 in 1970 to about 150,000 in 2022, according to the Bureau of Labor Statistics, due both to technology and cost-cutting.

Biden, who has called himself the most union-friendly president in history and pilloried companies for raking in "excessive" profits, praised a deal that he said would give workers "better pay, improved working conditions, and peace of mind around their health care costs."

Administration officials have been eager to resolve the dispute that threatened fresh goods shortages and added consumer price inflation ahead of November's midterm elections for control of Congress.

Senior congressional leaders had threatened to pass legislation imposing a resolution on the railroads and unions if the negotiations were not successful.

U.S. House Speaker Nancy Pelosi praised the tentative agreement and said that Congress was "ready to act" but that "thankfully this action may not be necessary."

A cargo train is seen near the border between the U.S. and Mexico, in Laredo
A cargo train is seen near the border between the U.S. and Mexico, in Laredo, Texas U.S. June 3, 2019. Reuters