US railroads and unions representing more than 100,000 workers reached a tentative deal, the government said, a breakthrough that looks to avert a labor disruption that risked adding supply-chain strains to the world’s largest economy.

After 20 straight hours of talks, the companies and union negotiators reached a tentative agreement balancing the needs of workers, businesses and the economy, according to a Labor Department statement early Thursday.

It was a “hard-fought, mutually beneficial deal,” the emailed statement said. “Our rail system is integral to our supply chain, and a disruption would have had catastrophic impacts on industries, travelers and families across the country.”

The deal extends the so-called cooling off period, during which the two sides have been negotiating, until union members can ratify it, an administration official said.

Aside from the disruption to key freight from corn to cars, the prospect of a strike put President Joe Biden in a political bind: push explicitly for a deal and risk undermining his pro-union campaign promises, or side with labor during a strike and risk getting blamed for hurting an economy beset with soaring inflation and supply-chain snarls.