AFFCO workers are set to receive a pay increase of 4.3% as part of their new collective agreement agreed with the meat processing company.
After hours of talks that began on Monday and went through the night, the company and Meat Workers Union agreed the deal at 5am on Tuesday.
Employees will return to work soon and ratification meetings for the agreement will be completed by next Monday.
AFFCO and the union had been at loggerheads over the collective agreement since late February. About 500 union members were locked out of eight North Island processing plants, while a further 800 have been on strike.
Tuesday's agreement protects wages, employment security and means workers will continue to have their terms and conditions negotiated by the union. They are back on the payroll again from Tuesday.
Council of Trade Unions president Helen Kelly took part in the all-night talks. She said the pay increase would come in two lots over 18 months and would be backdated to January this year.
Ms Kelly told Radio New Zealand's Checkpoint programme there would also be a one-off hardship payment to all workers locked out or on strike. An extra $400,000 has been set aside for this.
The Meat Workers Union has agreed to drug testing for workers.
AFFCO believes the deal should last for a long time. Operations director Rowan Ogg told Radio New Zealand's Morning Report programme the dispute was never about pay, but the company's right to manage its business.
Mr Ogg said he is satisfied with the agreement and believes it puts the company and workers in a good position.
Prime Minister John Key said it has been a bitter dispute, but it is positive that the parties have been able to find a resolution.
Iwi leaders played key role
A Maori leader says the deal struck would not have been possible without intervention by iwi.
AFFCO and the Meat Workers Union said iwi leaders worried at the impact the dispute was having on Maori families played a pivotal role in brokering the deal.
Some iwi farmers had suggested recently that they would not send business AFFCO's way if the dispute continued.
Sonny Tau, a spokesperson for the Iwi Leadership Forum, took part in the negotiations and told Checkpoint on Tuesday that threat was enough to get the company back to the negotiating table.
"That would make a big impression on any company. You can have the best possible facilities - but if you don't have any stock to go through it, you're not going anywhere fast."
Dispute has divided community - worker
AFFCO's Rowan Ogg expects there might be some tension at first between returning workers and those who worked through the dispute, but said hopefully, this would dissipate quickly.
Dana Irwin, who was on strike at the Wairoa plant, says the dispute has divided the community.
Ms Iriwn told Morning Report friendships and family relationships have been severed, as those who were locked out or on strike felt they were abandoned by those who signed individual contracts and kept working.
She said she does not know how people will react to each other when everyone is back at work.