A world-leading design of tidal power turbine will be built in the Western Isles under a deal between Scottish Power and its Norwegian partners.
The device is being tested off Orkney and it is hoped that more than 100 of the 25m-high turbines could eventually be built by Fife-based BiFab.
The project seeks to harness tidal power off Islay and Orkney.
The contract, for the Arnish yard in Stornoway, was announced during a visit to Norway by Alex Salmond.
The Scottish first minister is on a trade mission to the country to improve economic links.
The £4m deal was struck with Norwegian developer Hammerfest Strom to build the first of their advanced HS1000 tidal turbines.
Scottish Power Renewables, a major shareholder in Hammerfest Strom, is seeking permission to install 10 HS1000 machines in the Sound of Islay and is developing a 95-turbine project at Ness of Duncansbay, in the Pentland Firth.
Scottish Power Renewables managing director Keith Anderson said: "We are delighted Hammerfest Strom has announced that it will be constructing the first HS1000 turbine in Scotland.
"We know the company looked internationally to find the right levels of expertise to deliver this contract, so it is a major boost to Scotland's renewable energy industry and to the wider economy to see this new technology going in to construction in Stornoway."
Fraser McCreadie, managing director of Hammerfest Strom UK, added: "We look forward to working closely with BiFab as a key industrial partner to deliver a successful demonstrator project and to the future in supporting our further commercial tidal array projects."
Mr Salmond said: "Awarding £4m of contracts to Scotland is a massive vote of confidence in the talent, expertise and infrastructure we have to support the development of a clean, green renewables future."