By Medha Singh and Bansari Mayur Kamdar

(Reuters) – Shares of Union Pacific Corp and Norfolk Southern rose on Thursday after major U.S. railroads clinched a tentative deal with unions for better pay and working conditions, narrowly averting a rail shutdown.

The two sides reached the agreement following 20 hours of intense talks brokered by the Biden administration. The deal now goes to the unions to be voted on, a person familiar with the talks told Reuters.

Shares of Union Pacific and Norfolk Southern rose about 2% each, lifting the Dow Jones Transport index by 0.2%. The broader S&P 500 was flat.

Even if the unions reject the proposal, a rail shutdown that could have happened as soon as midnight on Friday has been averted for several weeks. A shutdown could have cost the U.S. economy $2 billion per day and led to food and fuel supply disruptions across the country.

“To the market, it’s just avoiding bad news. If we didn’t have a strike, it wouldn’t help the market but if we did have a strike, it would be a disaster,” said Andre Bakhos, managing member at Ingenium Analytics LLC in Plainsboro, New Jersey.

Negotiations between railroads including Union Pacific, Berkshire Hathaway’s BNSF, CSX, Norfolk Southern and Kansas City Southern and a dozen unions had stretched on for more than two years.

The deal also offers some relief to investors already grappling with the impact of the Federal Reserve’s relentless interest rate hikes to curb surging inflation.

Wall Street suffered its worst day in more than two years on Tuesday after a hot August inflation report fueled bets of more aggressive monetary policy tightening.

“Digging deeper, many might have wondered how much of an impact a strike might have on rate rise discussions due to the potential impact on inflation,” said Danni Hewson, financial analyst at AJ Bell.

CSX Corp shares dipped 2%. The company said CEO James Foote would retire this month and former president of Ford Motor, Joe Hinrichs, would replace him in the top role.

(This story refiles to correct name of the firm to “Ingenium Analytics LLC” from “New Vines Capital LLC” in paragraph 5)

(Reporting by Medha Singh and Bansari Mayur Kamdar in Bengaluru; Editing by Devika Syamnath)