Nepal is to allow United Nations staff into the country in an effort to stop human rights abuses.
Monitors will visit government troops and Nepal's Maoist rebels
The decision was announced in Geneva, where the UN Human Rights Commission is holding its annual session.
Nepal was facing condemnation over its human rights record, but a tough resolution looks likely to be dropped after the new agreement.
King Gyanendra imposed a state of emergency in February, in an effort he says to tackle a Maoist insurgency.
Nepal was set to be one of the key issues at the Human Rights Commission.
Human rights groups say the country's already poor record has become even worse since King Gyanendra dismissed the government and assumed direct power in February.
The BBC's Imogen Foulkes in Geneva says condemnation by the commission looked certain - but analysts say Nepal's agreement to allow in human rights monitors, made just hours before a condemnatory resolution was due to be submitted, means that has probably been avoided.
The UN human rights chief has visited Nepal in recent months
The UN Human Rights Commissioner Louise Arbour, and Nepal's Foreign Minister, Ramesh Nath Pandey, signed an agreement allowing the operation to begin immediately.
An office will be set up in Nepal to monitor the upholding of international human rights norms.
It will report regularly to the commission and it will advise the government of Nepal on how to promote human rights.
It will also seek the co-operation of both government forces and Maoist rebels to ensure that human rights violations are reported and investigated.
Louise Arbour, who herself called on the commission to take action over Nepal's human rights record, said she hoped the monitoring operation would help to break what she described as the "cycle of serious and systematic abuses".
The BBC's Charles Haviland in Kathmandu says the new bureau is a major step in a country whose human rights situation has been declining disastrously.
The country's Maoists have been fighting for nearly 10 years to replace the monarchy with a communist republic. About 11,000 people have been killed.