The deal, which is worth about £97m, was confirmed at the SNP's annual conference in Aberdeen by Transport Minister Derek McKay.
Ferguson's had previously been named as the preferred bidder for the contract.
The firm was saved by businessman Jim McColl's Clyde Blowers Capital after it went bust on 15 August. Mr McColl is one of Scotland's wealthiest people.
Originally formed in 1902, Ferguson's employed 77 staff at the time of the administration appointments.
Ferguson's shipyard on the Clyde has won a Scottish government contract to build two new ferries.