Negotiations began after the UK Government decided to impose changes to the General Medical Services contract for 2013-14.
At that time, the Scottish Government approached the Scottish GP Committee of the British Medical Association (BMA) seeking talks to agree alternative arrangements in Scotland, within the framework of the UK GP contract.
A BMA spokesman said the contract would bring clinical benefits to patients, focus on more vulnerable patients, create stability for practices and address workloads.
Dr Alan McDevitt, chairman of the BMA's Scottish GP committee, said: "This approach is very different to that being taken by the UK Government where there is a threat to impose changes that have not been negotiated or agreed with the profession.
"It reflects our need to manage workload in general practice and a shared desire to introduce changes that focus on the needs of our patients.
"The agreement provides much-needed stability for general practice funding."
Health Secretary Alex Neil said: "The measures will bring real benefits to patients, with GPs working more closely to help those patients most at risk of hospital admission.
"I pay tribute to the leadership shown by BMA in Scotland to get us to this point."