NEW YORK (AP) — Macy’s and the union representing workers at its flagship Manhattan store and three other New York locations reached a tentative contract agreement Thursday following all-night negotiations.

The union and Macy’s made the announcement on the five-year proposed pact in separate statements.

Local 1-S of the Retail, Wholesale and Department Store Union said workers at the Union Square flagship store would begin voting on the proposed contract on Thursday. Workers at the other stores, in the Bronx, Queens and Westchester County, would vote next Monday through Wednesday, it said.

“This is a solid contract and it reflects the fact that our workers are the true magic of Macy’s,” said RWDSU president Stuart Appelbaum.

Earlier this week, more than 4,000 of the unionized workers voted to strike if a new contract was not reached by 11:59 p.m. Wednesday.

Macy’s spokeswoman Elina Kazan said in a statement that the tentative agreement reflected the efforts by both sides to address “the economic and business realities of the retailing industry, while keeping jobs at Macy’s among the best.”

The issues dividing the parties had centered on pension benefits for new employees and health care costs.