At least 430 jobs have been saved at a Wirral biscuit factory threatened with closure, unions have said.
The proposals will go before the workforce later
Burton's Foods announced up to 821 jobs would go at its site in Moreton following an "extensive" review of its business operations earlier this year.
Unite union officials have now agreed a deal with Burton's bosses which include making £7.3m worth of savings and retaining at least half the workforce.
The site, which produces Wagon Wheels, has been guaranteed work until 2012.
Some products which had been earmarked for production elsewhere will now stay at the factory.
The proposals are to go before the workforce later.
Tony Woodley, joint general secretary of Unite, said: "There is no doubt in my mind we have put together the best deal available for Moreton in the circumstances.
"Work has been guaranteed and jobs have been saved. We now have a basis for looking forward."
He also thanked local MP Angela Eagle and Wirral Borough Council in ensuring the agreement was made.
Paul Kitchener, chief executive of Burton's Foods, said: "Following a constructive consultation process we have developed an alternative proposal for Moreton that will see the creation of a centre of manufacturing excellence for our seasonal ranges.
"We would like to thank our Moreton staff and their representatives for their continued commitment and valuable input.
"Full closure of the Moreton site has been averted and, importantly, manufacturing is to stay," said Mr. Woodley.
"It is, in my view, the best deal in the circumstances."
Duke Street Capita, the private equity house which owns Burton's Foods, initially said it was closing the factory because of "over-capacity" in the biscuit industry.
The firm, which makes Cadbury Fingers, Highlights and Digestives, Jammie Dodgers, Maryland Cookies and Wagon Wheels, together with a range of own label biscuits, also owns factories in Blackpool, Edinburgh and Llantarnam, South Wales.