The Ministry of Defence (MoD) has guaranteed BVT shipyard operators shipbuilding work for the next 15 years.
The firm, who run shipyards on the Clyde and in Portsmouth, have an agreement worth £230m.
The MoD describe it as an "unambiguous commitment" that would require efficiency improvements intended to generate at least £350m of savings over the course of the contract.
The deal comes three weeks after a leaked memo suggested that either of the yards could close in 2014 if new work was not secured after the completion of two giant aircraft carriers for the Royal Navy.
In a leaked document BVT's chief executive detailed that the UK government was willing to pay up to £165m for the costs of closure, including redundancies and environmental clean-up.
Emergency talks were held between Scottish Secretary Jim Murphy and BVT.
Mr Murphy said the new agreement gives the shipbuilding industry the framework it needs to plan confidently for the future.
He said: "That means jobs and it means skills for Scotland and it is great news, especially coming at a time of economic uncertainty."
Alan Johnston, chief executive of BVT, said: "It will ensure that we can affordably deliver key capability to the Royal Navy in this country for many years to come, strengthen our competitiveness in the international market, and deliver security to the shipyards that has not been known for decades."
Last year the MoD forced the merger of BAE Systems and VT who build the Royal Navy's more complex ships.
(GK/JM)
Scotland
UK
Ireland
London











