UPS and the Teamsters union reached a tentative agreement for a new five-year contract covering 340,000 workers at the nation’s largest package carrier, six days before a threatened strike that threatened to disrupt deliveries across the country.

Union leaders announced the agreement at midday Tuesday, hours after resuming negotiations following a breakdown in talks on July 5. The handshake agreement still needs to be approved by rank-and-file union members at UPS for it to take effect.

“UPS has put $30 billion in new money on the table as a direct result of these negotiations,” Teamsters President Sean O’Brien said in a statement Tuesday. “This contract sets a new standard in the labor movement and raises the bar for all workers.”

In a statement shared with NBC News, UPS CEO Carol Tomé said, “Together we reached a win-win agreement on the issues that are important to Teamsters leadership, our employees, and to UPS and our customers.

“This agreement continues to reward UPS full-time and part-time employees with industry-leading wages and benefits, while retaining the flexibility we need to remain competitive, serve our customers, and keep our business strong,” he added.

While the two sides had already reached agreements on most issues weeks ago, a handful of important economic issues remained unresolved when negotiations resumed, including pay for part-time drivers. The deadlock, about three weeks before the union threatened a strike, raised concerns among small business owners who rely on UPS to ship their packages.

UPS workers voted overwhelmingly on June 16 to authorize a strike if an agreement could not be reached before their current contract expires on July 31.

That step came just days after union leaders and UPS reached an agreement on thermal safety issues, including an agreement to provide air conditioning in UPS’s fleet of iconic brown delivery vehicles for the first time. The Teamsters hailed those changes as a breakthrough after years of complaints that working in hot climates has become more dangerous as climate change fuels stretches of record temperatures across the country.

The tentative deal unveiled Tuesday also removes a feature of the current labor agreement that many rank and file members had reviled from the start: a part-time driver class known as «22.4s,» named for the section of the contract that created them.

Disapproval of that two-tier system contributed to UPS workers rejecting the contract negotiated by Teamsters leaders in 2018, but union officials used procedural measures to enforce the deal anyway. Infighting triggered a leadership shakeup that brought O’Brien to power.

Under the new agreement, 22.4 drivers would be reclassified as regular drivers and would see their wages adjusted accordingly. It will also prevent UPS from requiring drivers to work overtime on their scheduled days off.

Also included in the five-year contract agreement are what the union called “historic” wage increases. Current full-time and part-time union workers are guaranteed a wage increase of $2.75 per hour this year, the Teamsters said, which equates to an increase of $7.50 per hour for the duration of the contract.

Pay for existing and new part-time workers, which UPS and Teamsters leaders described as the last hurdle for the contract, will increase to at least $21 an hour immediately and advance to $23 an hour.

Current part-time workers also earned longevity pay increases of up to $1.50 per hour. The wage increases for full-time workers bring their average maximum rate to $49 an hour, the union said.

A work stoppage by UPS drivers would have been the largest single employer strike in US history. a recent forecast by Anderson Economic Group estimated that a 10-day strike would cost the US economy some $7 billion, with workers racking up $1.1 billion in lost wages and UPS seeing $816 million in losses.

The last strike at the company, in which some 185,000 workers participated, lasted 15 days in 1997 and focused on obtaining better wages and job security. Ultimately, it cost UPS $600 million in revenue, but resulted in gains for employees on both measures.

The rise of e-commerce, accelerated by the pandemic, recast the demands of UPS workers in the latest round of contract negotiations. Now they are sorting and delivering millions more packages: 6.2 billion worldwide in 2022, up from 5.5 billion in 2019. Labor leaders had argued that UPS should use the $13 billion it generated in profits last year to improve pay and working conditions for employees.

Logistics experts had warned that a prolonged strike this time would likely have disrupted far more deliveries than major rivals like FedEx or the US Postal Service could absorb, potentially disrupting the back-to-school shopping season. In early July, FedEx was urgencyin g potential newcomers to move quickly, saying it had limited spare capacity to take on overwhelmed customers. The Postal Service offered assurances at the time that it could handle the extra volume of the package.