They had to navigate through a handful of obstacles, including a disputed reference to "foreign occupation" that was an apparent jab at Israel.
The agreement was reached on Friday evening by a UN General Assembly committee.
The draft of the UN convention on rights of persons with disabilities would require countries to guarantee freedom from exploitation and abuse for the disabled, while protecting rights they already have, such as ensuring voting rights for the blind and providing wheelchair-accessible buildings.
Jan Eliasson, the UN General Assembly president, congratulated the committee members after the draft was adopted.
"You're sending the message that we want to have a life and dignity for all and that all human beings are equal," he said.
Advocates hope the treaty will be adopted by the General Assembly during its upcoming 61st session, which starts in September.
The process was bogged down by a few issues on Friday, with states "digging in on their positions", said New Zealand ambassador Don MacKay, the chairman of the drafting committee.
Arab states were insistent on the text calling for the "full protection of persons with disabilities, in particular during armed conflicts and foreign occupation", an apparent reference to Israel's control over Palestinian territory.
Representatives from the United States, Australia, Canada, Japan and Israel objected to the text in a separate vote. The Israeli representative called it, "a clear attempt to politicise the convention".
"You're sending the message that we want to have a life and dignity for all and that all human beings are equal"
UN General Assembly president
References to sexual and reproductive health in regards to healthcare and other language, including the definition of disability, had also drawn opposition.
The negotiations brought together hundreds of non-governmental organisations and delegates representing the world's 650 million people with disabilities.
Agreement had earlier been reached on the longstanding sticking point of a monitoring mechanism that would ensure conditions of the treaty would be met.
But some committee members were critical of the compromise that ruled out visits by a human rights committee.
A number of states made broad but strong objections to the article, said Lex Grandia, president of the World Federation of the Deafblind.
"I think it made some of the countries nervous, but this is exactly where you don't say what you think," he said.
The compromise relies on individuals and NGOs to report infractions of the treaty.
Eighty percent of persons with disabilities live in developing countries, according to the UN Development Programme.
The US Mission to the United Nations has said it is opposed to the convention on grounds that it would dilute the strength of US legislation protecting the rights of the disabled.
But it said Washington fully supports the improvement of international standards for the disabled.