Scotland's voters are in control of their country's destiny after the two leaders signed the Edinburgh Agreement at the Scottish Government's headquarters, St Andrew's House, in the capital.
An Order under Section 30 of the 1998 Scotland Act will transfer powers to Holyrood, allowing a single- question referendum to take place by the end of 2014.
Campaigning has already started, with both sides predicting victory.
The First Minister, who shook hands with the Prime Minister outside, said he believed "with all my soul" that Scots would vote for independence and negotiations over the break-up of the UK would start the day after the referendum.
Scottish Secretary Michael Moore insisted the referendum would produce a "strong endorsement of Scotland as part of the UK".
However, rows over the role of the poll's watchdog, which could have a major impact on the outcome, erupted before their signatures were dry.
The First Minister faced pressure to abide by Electoral Commission advice on contentious issues including the wording of the question and campaign spending limits.
Meanwhile, the prospect of Mr Salmond and Mr Cameron locking horns in a live TV debate on independence became an issue after the First Minister said he would be delighted to take part in the contest.
His challenge was dismissed as "curious" by Mr Moore, who said Scots campaigners and politicians should lead them.
A spokesman for the Prime Minister said: "It is something we will have to take back and consider."
Meanwhile, a ComRes poll for ITV News at Ten showed 55% of Scots felt the country's economy would suffer if it split from the UK.