Liberia is to become the first nation in Africa to completely stop cutting down its trees in return for development aid.
Norway will pay the impoverished West African country $150m (£91.4m) to stop deforestation by 2020.
There have been fears that the Ebola crisis would see increased logging in a country desperate for cash.
Norwegian officials confirmed details of the deal to the BBC at the UN climate summit in New York.
Liberia's forests are not as big as other countries but the country is home to a significant part of West Africa's remaining rainforest, with about 43% of the Upper Guinean forest.
It is also a global diversity hotspot, home to the last remaining viable populations of species including western chimpanzees, forest elephants and leopards.
But since the civil war ended in 2003, illegal logging has become rife.
In 2012, President Ellen Johnson Sirleaf attracted international criticism when she handed out licences to companies to cut down 58% of all the primary rainforest left in the country. After protests many of those permits were cancelled.
Some researchers have connected the current outbreak of Ebola with the widespread destruction of the forests, bringing people into contact with natural reservoirs of the virus.
Now the Norwegians and the Liberian government have signed a deal that they both believe will protect the forests into the future.
"We hope Liberia will be able to cut emissions and reduce poverty at the same time," said Jens Frolich Holte, a political adviser to the Norwegian government, speaking to the BBC on the sidelines of the UN climate summit in New York.
"We have funded efforts in Indonesia and Brazil, but I think this is the first time we have entered a deal on a country level."
Under the terms of the agreement, Norway will help Liberia to initially build up the capacity to monitor and police the forests.
Liberia will refrain from issuing any new logging concessions until all existing ones have been reviewed by an independent body.
The country agrees to place 30% or more of its forest estate under protected area status by 2020. It will also pilot direct payments to communities for protecting the forest.
Ultimately the Norwegians will pay for results, with independent verification that trees remain standing.
The development has been welcomed by environmental campaigners in Liberia.
"This partnership holds promise not only for the forest and climate; but for forest communities that have been marginalised for generations," said Silas Siakor, a Liberian environmental campaigner and Goldman Environmental Prize laureate.
"The partnership's commitment to respecting and protecting community's rights with respect to forests is laudable."
Experts believe that Liberia has turned to logging as a way of raising cash in difficult times. With the current Ebola outbreak having a significant economic impact on the country, the Norwegian deal is timely.
"Our hope is that the situation there now will be contained and resolved," said Mr Frolich Holte.
"But we also need to give Liberia a long term hope for development and that is what this rainforest money will provide for them, a long term vision for a country with reduced poverty and reduced deforestation."
With widespread corruption and a government struggling to impose its authority, campaigners recognise that stopping all the logging in Liberia will not be easy.
"There is the potential for this to go wrong, both Norway and Liberia will have to make sure that this deal does not get affected by corruption, but I am cautiously confident it can be done," said Patrick Alley, the director of campaign group Global Witness.
"It's really good news, it's transformational for Liberia when all the news coming out of there is bad - I think this will be a real boost."
Follow Matt on Twitter.