The giant Grangemouth petrochemical site has been rescued from closure, safeguarding hundreds of jobs and heralding a "bright future" for the local community.
The owner's reversal of its decision to axe the plant followed acceptance by the Unite union of a survival plan for the business, including a three-year pay freeze, ending of the final salary pension scheme and other changes to terms and conditions.
Owners Ineos said 48 hours previously that it would close the site, which employs 800 people, because workers refused to sign up to the changes.
Staff gave large cheers when they were told news of the turnaround at a mass meeting with managers earlier today.
The news was also welcomed by the union Unite and politicians in London and Edinburgh who were locked in talks with all sides to try to resolve the situation.
Ineos said it will immediately reopen the site and the adjoining oil refinery, which it had kept shut for the past week, and that it would now invest £300 million in the site's long-term future.
According to Grangemouth chairman Calum MacLean, the union "U-turn" means the complex now has "an excellent future".
He told a press conference: "We are very happy to announce that following a meeting with shareholders yesterday, Grangemouth petrochemicals will remain open. Ineos have confirmed that the £300 million that they are going to put into it will be available and we will start immediately with those projects again."
The money will be used to fund losses and the building of a gas terminal to bring in shale gas ethane from the US, Ineos said.
But Mr MacLean still did not rule out the possibility of job losses, although he insisted any redundancies would be "very limited".
Workers at the site welcomed the turnaround which could allow the petrochemical plant to stay open for another 15-20 years.
John Convery, a reliability manager, said the last couple of days have been "hellish".
He said: "We were told that the company we work for was going into liquidation and we didn't know if we were going to get any redundancy or what was going to happen to our pension, and everybody naturally assumed the worst.
''There was a lot of relief and a lot of emotion in there. We're relieved that we've still got a job."
Engineer Paul Lindsay said: "Obviously this week's been terrible, thinking that you're out of a job, but now it's back to normal and they said the plant's got a long-term future, so hopefully that's a bit of security for all the folk that have been worrying this week."
Politicians from the UK and Scottish governments were pressing the two sides to break the deadlocked row, warning of the grim impact on the economy if the firm shut the plant.
Scotland's First Minister Alex Salmond said of the development: "This news is a tremendous fillip for the workforce and the whole Grangemouth community, following what could have been a potential disaster.
"It's been a great team effort from all concerned, including the unions and workforce, the management, governments and BP who have made a material contribution to help defend and secure Scottish jobs and livelihoods. I am delighted that people have rallied round to protect these jobs, and now we can all agree that Grangemouth has an outstanding future.
"Clearly for many people across the communities of the Forth Valley, Wednesday was a day of despair. Today is quite different, and is a day of great satisfaction that not only has a key part of Scotland's industrial infrastructure been saved but that people can look forward with confidence to a bright future."
Scottish Secretary Alistair Carmichael, who was involved in the talks yesterday, said the workers can now look to the future with optimism after an uncertain time.
"This is the outcome we have worked towards and one which Scotland and Grangemouth deserve," he said.
"There are undoubtedly lessons to be learned from this dispute but for now we should focus on the immediate success of securing the site's future."
Unite's general secretary Len McCluskey met shop stewards and managers at Grangemouth yesterday after announcing that the union decided to "embrace" the survival plan proposed by Ineos which claimed the site is losing £10 million a month.
Unite's Scottish secretary, Pat Rafferty, welcomed today's decision, saying: "Relief will ring right round the Grangemouth community, and across Scotland today. Hundreds of jobs that would have been lost can now be saved and £300 million will be invested into the plant.
"Grangemouth is the powerhouse of the Scottish economy. It now has a fighting chance of upholding this crucial role into the future.
"Obviously today's news is tinged with sadness. Decent men and women are being asked to make sacrifices to hold on to their jobs but the clear wish of our members is that we work with the company to implement its proposals."
Jim Ratcliffe, chairman of Ineos Group, said the development is "a victory for common sense".
A consultation will now start on the new terms of employment.