Minnesota's rail-dependent farmers and businesses sighed with relief Thursday after union and railroad leaders reached a labor agreement, averting a strike that would have dealt another blow to the nation's already precarious economy.

President Joe Biden announced the tentative deal after a marathon 20-hour negotiating session at the Labor Department, one day before the threatened walkout.

"This agreement is validation of what I've always believed — unions and management can work together ... for the benefit of everyone," Biden said at the White House.

The deal, which includes a 24% pay raise, will go to union members for a vote after a cooling-off period of several weeks.

Few states shuttle more rail freight than Minnesota — from iron ore and taconite to farm and food products. About 80% of the state's roughly 4,300 rail workers are unionized, said John Apitz, legislative counsel for Minnesota Regional Railroads Association.cqpm

In 2019, 88.6 tons of rail freight in 1.1 million railcars originated in Minnesota, the fourth-highest by volume, according to the American Association of Railroads.

The looming strike raised concerns across Minnesota's farm country as combine tractors were preparing to head into grain fields for harvest.

Jason Krohn farms 5,000 acres of corn and soybeans in Slayton, Minn. On Wednesday evening before the agreement was reached, he said farmers would have felt an immediate impact if the strike had proceeded.

"'Devastating' would be the word you'd have to use," Krohn said. "Rail touches every aspect of agriculture directly. We could probably sustain days without a catastrophe, but not weeks."

Farmers use rail to get feed for their animals and fertilizer for their fields. They use it to ship crops to market. The trickle-down would almost certainly have caused prices to go up at a time consumers are already grappling with high inflation.

It also would have hit the ethanol industry hard. Minnesota is one of the nation's largest ethanol producers, and 80% of of their output moves by train, said Brian Kletscher, CEO of Highwater Ethanol in Lamberton and chairman of the Minnesota Bio-Fuels Association, a trade group.

"It's a very big deal that the strike was averted," he said.

In the days leading up to the strike deadline, Eden Prairie-based C.H. Robinson, the nation's largest logistics company, hustled to create back-up plans for its 7,500 retail customers, many of whom depend on rail transportation, Tim Humbert, vice president of North American Intermodal, said in a statement.

"Those center-of-the-store items like toothpaste and boxes of pasta, for example, are the types of things that tend to move by rail because they're less perishable," Humbert said. "Our fresh produce customers also use rail to move hardier things like potatoes, onions and oranges."

And the company's food, beverage and health care customers wanted to shore up alternative plans for moving raw materials necessary to maintain production, he said.

"For our customers and the good of the entire logistics industry," he said, "we're glad that all the parties involved in the negotiations were able to reach an agreement."

Averting a strike means the U.S. economy dodged the most serious economic damage that could have resulted from the labor dispute. However, there could still be a short-term ripple effect in supply chains as some companies had preemptively begun shifting to trucks ahead of the looming strike, said Emily LeVasseur, managing director at Eden Prairie-based supply chain consultancy Waypost Advisors.

A rail car holds the equivalent of about four truckloads — and truckers are also in short supply. "Some shippers were scrambling to secure four times as many trucks as they had railcars," LeVasseur said.

The rail industry still must solve the long-term issues of attracting and retaining workers — a major cause of backlogged shipments, overflowing warehouses and congested ports, she said.

Shippers have complained loudly this year about delays and poor service as railroads struggled to quickly hire enough workers to handle a surge in demand as the economy emerged from the pandemic. The shipping problems gave rail workers extra leverage.

"Certainly a rail strike would have been an absolute disaster," LeVasseur said. "Hopefully, this means railroads won't have such a hard time hiring people."

Biden appeared alongside union leaders in the White House Rose Garden and hailed the deal in remarks Thursday morning.

"These rail workers will get better pay, improved working conditions, and peace of mind around their health care costs: all hard-earned," he said. "The agreement is also a victory for railway companies who will be able to retain and recruit more workers for an industry that will continue to be part of the backbone of the American economy for decades to come."

Four major railroads operate in Minnesota. Texas-based BNSF Railway is the largest with about 1,500 miles of track. Calgary-based Canadian Pacific Railway, which was not part of the Union negotiations, is second with more than 1,100 miles of track. Minneapolis has been Canadian Pacific's U.S. headquarters, though it will relocate to Missouri with the company's acquisition of Kansas City Southern.

Other large operators include Canadian National and Union Pacific.

The five-year deal, retroactive to 2020, includes $5,000 in bonuses. And the railroads agreed to ease their strict attendance policies to address union concerns about working conditions.

Workers will now be able to take unpaid days off for doctor's appointments without being penalized. Previously, they would lose points under the attendance systems at BNSF and Union Pacific railways, and could be disciplined if they lost all their points.

The talks also included Norfolk Southern, CSX, Kansas City Southern and the U.S. operations of Canadian National.

The unions that represent conductors and engineers who drive the trains had pressed hard for changes in the attendance rules, and they said the deal sets a precedent that ensures they will be able to negotiate such rules in the future.

Victor Chen, a sociologist at Virginia Commonwealth University who studies labor, said concerns about working conditions have increasingly become a priority for unions and the workers they represent.

"At a certain point, good wages just aren't enough to make up for the toll these sorts of working conditions impose on workers," Chen said. "The companies need to treat workers like human beings, rather than just inputs in a business process."

The rail unions pointed to workload and attendance rules after the major railroads cut nearly one-third of their workforce — some 45,000 jobs — over the past six years.

The industry has aggressively cut costs everywhere and shifted operations to rely more on fewer, longer trains, which use fewer locomotives and fewer employees. The unions said the remaining workers, particularly engineers and conductors, were on call 24/7 because of jobs cuts and could hardly take any time off under strict attendance rules.

Unions had an advantage at the bargaining table because of the tight labor market and ongoing service problems on the railroads, Chen said.

A strike would also have disrupted passenger traffic as well as freight because Amtrak and many commuter railroads, including Metro Transit's Northstar Line, operate on tracks owned by the freight railroads. Before the strike deadline, Amtrak had canceled all of its long-distance trains, including through Minnesota, and was working Thursday to restore full service.

The threat of a shutdown carried political risks for Biden, a Democrat who says he believes unions built the middle class. But he also knew a rail strike could damage the economy ahead of the midterms, when majorities in both chambers of Congress, key governorships and scores of important state offices will be up for grabs.

A stoppage could halt shipments of food and fuel at a cost of $2 billion a day — worsening the dynamics that have contributed to soaring inflation.

"Especially now, with rising inflation and the nation's supply chains struggling toward recovery, a rail strike would have been acutely painful for manufacturers, shippers, retailers and consumers, both regionally and nationwide, so today's announcement of a tentative strike-averting deal is certainly welcome news," said Deb DeLuca, executive director of the Duluth Seaway Port Authority. DeLuca is also chair of the Minnesota Freight Advisory Committee.

Staff writers Brooks Johnson, Mike Hughlett and the Associated Press contributed to this report.