US rail companies and unions have reached a “tentative” deal to avert a major strike over the weekend, US President Joe Biden said in a statement on Thursday. “The tentative agreement reached tonight is an important win for our economy and the American people,” the statement on the White House website said. “These rail workers will get better pay, improved working conditions, and peace of mind around their health care costs: all hard-earned,” it added. The strike had threatened to disrupt travel and supply chains two months before crucial midterm elections. Pressure had been growing on both sides to reach a deal, with national rail operator Amtrak canceling passenger routes in anticipation of disruption as farmers and retailers warned of supply chain chaos. The announcement came after freight railroad companies and two unions representing mainly train conductors had been called to a meeting at the Labor Department in Washington on Wednesday in an effort to avert a strike on Friday at midnight. “I thank the unions and rail companies for negotiating in good faith and reaching a tentative agreement that will keep our critical rail system working and avoid disruption of our economy,” Biden said. Biden regularly expresses strong support for workers but is also struggling to avoid further economic damage ahead of midterm congressional elections in early November. Voters already are worried about soaring prices in the post-pandemic economy, where supply chain issues have been a constant scourge and annual inflation has surged to a 40-year high. The Association of American Railroads had warned that a strike would bring 7,000 trains to a halt, costing $2 billion a day. “Moments ago, following more than 20 consecutive hours of negotiations at @USDOL , the rail companies and union negotiators came to a tentative agreement that balances the needs of workers, businesses, and our nation’s economy,” tweeted US Secretary of Labor Marty Walsh.