After weeks of talk of a possible strike, Safeway and its workers reached an agreement early Thursday morning that would avoid a work stoppage.

The deal, which some 10,000 union members ratified hours later, comes after six months of negotiations with Albertsons, which acquired Safeway in 2015. Workers were prepared to vote for a strike scheduled 11 hours after a deal was reached.

“These negotiations were long and unusually complex due to the difficult pension issues we needed to resolve, but I am pleased to say we were able to reach a tentative agreement with Safeway that preserves retirement security for our members,” Mark Federici, president of the United Food and Commercial Workers Local 400, said in a statement.

It is similar to a contract the union struck with Giant Food, ratified days ago, which union spokesperson Jonathan Williams said could set precedent.

“To our knowledge, these are the only contracts in the country where union workers have won guaranteed retirement benefits from a multi-employer pension plan,” Williams said.

In a statement Thursday afternoon, Safeway said, in part, “The agreement was unanimously ratified by our employees. We are grateful to our team that diligently worked with the union to make today a success.”

The proposed contract includes:

Increasing company pension contributions by $18.6 million per year, or $74.4 million over the four-year life of the contract.

$49.5 million in overall wage increases over the four-year life of the contract.

The overall wage increases would be as follows:

Year 1 — wage increase by $4 million

Year 2 — wage increase by $8.8 million

Year 3 — wage increase by $15.3 million

Year 4 — wage increase by $21.4 million

The Safeway meeting was held Thursday afternoon at the Gaylord National Resort and Conference Center. It was closed to the public.

WTOP’s Megan Cloherty contributed to this report.