The SNP in return has been promised a “no surprises” approach to parliamentary business from their new partners.
However, the deal was immediately criticised by opposition parties as “anti business” and a “disaster for Scotland”.
The Scottish Conservatives also demanded the Scottish Greens lose their privilege of being able to quiz Nicola Sturgeon at First Minister’s Questions given they are now part of the government.
New pro-independence party Alba also poured cold water on the deal, claiming it had kicked a second referendum “into the long grass”, with the constitutional issue coming behind the controversial reform of the Gender Recognition Act in a timetable of priorities.
The deal, which is not a traditional coalition in that it allows the Scottish Greens to retain opposition to Scottish Government policy in nine specific areas, was accepted “unanimously” by Nicola Sturgeon's Cabinet on Friday morning, according to the First Minister.
The agreement will go to the SNP’s national executive committee (NEC) on Saturday to be rubber stamped. Scottish Green party members have until August 28 to decide whether or not to back the agreement and could vote against it.
The agreement has been hammered out since Parliament broke for recess at the end of June after Ms Sturgeon revealed she wanted to partner with the Scottish Greens in the wake of the May Holyrood election that saw her party fail to gain an outright majority by one seat.
The Scottish Greens, led by Patrick Harvie and Lorna Slater, had seen their number of MSPs rise to eight from six, although the group lost a member when Alison Johnstone was appointed Presiding Officer.
Announcing the deal, Ms Sturgeon said: “We do not agree on everything, but we are coming out of our comfort zones to focus on what we do agree on. Despite all of the risks inherent in any decision of two parties to co-operate more closely, we are choosing to work together.
“The agreement delivers bold policy action on pressing issues. A commitment to more affordable housing, a better deal for tenants and action to tackle poverty and inequality. Steps to accelerate our transition to net zero – more support for active travel, transformation of home energy and a ten-year transition fund for the north east of Scotland.
"A focus on green jobs and fair work – and a sustainable recovery from Covid. We also reaffirm in this agreement our shared commitment to securing independence for Scotland, and to giving people the right to choose our country’s future through a referendum.
“It recognises that business as usual is not good enough – we need boldness, courage and a will to do things differently. That is what we offer.”
Mr Harvie described the deal as a “historic moment”, with Greens entering government “for the first time ever in Scotland or anywhere in the UK”.
He said: “It could not come at a more important time. We must build a fairer and compassionate country and we must do everything in our power to tackle the escalating climate and nature emergencies to deliver a just transition for all.
"Fundamentally this is a new approach to politics. We agree on some things and disagree on others – those distinctive voices can and will remain.”
His co-leader Ms Slater said: “The stakes could not be higher – with the COP26 climate conference coming to Glasgow, Scotland is in a position show real leadership on climate.
"But this deal is about people as well as the planet. Together, we would deliver a new deal for tenants, giving tenants more rights and introducing rent controls to help tackle Scotland’s housing crisis, create a new national park and much more. That’s why we are pledging to work together to build a greener, fairer and independent Scotland.”
Ms Sturgeon revealed the deal had been “unanimously” approved by her Cabinet and she would take it to the NEC.
"I'm excited about this agreement,” she said.
"I know SNP members want to continue to tackle the climate emergency, we want to make Scotland a better place and, of course, we want to secure an independence referendum.
"So I think there'll be a lot of enthusiasm and excitement on the part of SNP members and I look forward to engaging in those discussions in the days to come.”
Mr Harvie said the agreement had not been “hammered out by the three of us behind closed doors”.
He said Green members had been asked for their priorities and the party was “about to enter a week of debate about the deal, with an extraordinary general meeting next weekend".
"I'm very confident and hopeful that Greens across the country will see this as an extraordinary opportunity,” he said.
The deal will see Green MSPs support the Scottish Government on confidence votes, as well as in annual budgets if there is “appropriate funding for the shared policy programme”.
However, a number of areas are excluded from the agreement, including much of aviation policy, the future of green ports, and direct financial support to businesses involved in the aerospace, defence and security sectors, and field sports.
Other exclusions – areas where the two parties could not agree – include fundamentals such as using GDP as a measure of economic growth and the “legal status and regulation” of prostitution. The Greens will also be able to differ on private schools, international relations and membership of Nato.
The Scottish Conservatives and Labour both raised concerns about the deal.
Scottish Conservative leader Douglas Ross said: “If it looks like a coalition and acts like a coalition, it’s a coalition. No amount of spin from Nicola Sturgeon and the Greens can change that.
“They will work and vote together as one nationalist government on all, but a handful of issues.
“The 50-odd pages of their policy programme could be boiled down to one word above everything else – separation. This is a nationalist coalition of chaos focused on splitting up the country and dividing Scotland with another bitter referendum.”
He added: “Nicola Sturgeon failed to win a majority so she’s had to turn to the extremist Greens to help her push for indyref2 during an economic crisis.
“It shows just how weak the SNP feel their case is that they’ve had to break bread with a party that is even more anti-jobs, anti-business and ideologically extreme than they are.”
Scottish Labour leader Anas Sarwar said the deal was a formalisation of a “coalition of cuts that has been in action for years”.
"This will come as a surprise to no-one, but it is a disaster for Scotland,” he said.
“This straitjacket deal covers all but a handful of issues, with the so-called Greens endorsing the SNP's dismal track record on everything from austerity to the environment.
“We must push the Scottish Government to take more decisive action on climate change and tackling inequality. But the reality is from damaging cuts to Scottish Councils to voting down pay rises for care workers, the Green’s role has been to nod through SNP’s most damaging plans.
“It’s hard to believe they will be a strong voice within government when they certainly never were in opposition. Scotland deserves a government focused on recovery, not on stitching up votes in Parliament.
“Months have been wasted negotiating this rubber-stamp for SNP policy. Meanwhile, A&E is in crisis, we are facing a growing cancer emergency, and we are still waiting for the NHS Recovery Plan."
A spokesman for the Scottish Greens said: “It’s no surprise that parties only interested in scoring political points would be alarmed about any suggestion of co-operation in the interests of people and planet.
“People vote Green to get results, and over the last five years the Scottish Greens have achieved more from our manifesto than Labour and the Tories combined. We will continue to do that, whatever happens.”
A spokesman for the First Minister said: “Following the SNP’s record landslide election win in May, the First Minister extended an open invitation to all parties to discuss areas where they thought they could work closely with the SNP in Government for the common good – in the face of the extraordinary challenges facing us such as the climate emergency and recovering from the pandemic.
“The fact that Labour and the Tories chose not to pursue that offer says far more about them than anyone else.”
Alba MP Neale Hanvey said the deal proved the SNP and Greens were not making a second referendum an “urgent priority”.
“Before the election the Greens said they wanted a referendum by 2026 and the SNP have failed to pursue the mandate gained in the Scottish Parliament elections,” he said.
“Independence is the vital key to Scotland’s ambitions. This deal casts it as a complete and utter afterthought.“
Pamela Nash, chief executive of Scotland in Union, said the parties should focus on recovery following the Covid pandemic.
“For the SNP and Greens to re-open old arguments and seek to divide our people would be an astonishing dereliction of duty at such a vital time,” she said.
"As part of the UK we can bring communities together and pool and share resources across the country, working to build a successful recovery that leaves nobody behind. That should be the priority for the new government.”