Muslim and Western nations overcame deep divisions to agree on a landmark United Nations code to combat violence against women and girls.
Iran, Libya, Sudan and other Muslim nations ended threats to block the declaration and agreed to language stating that violence against women could not be justified by "any custom, tradition or religious consideration."
Western nations, particularly from Scandinavia, toned down demands for references to gay rights and sexual health rights to secure the accord after two weeks of tense negotiations between the 193 UN member states.
Some 6,000 non-government groups were in New York for the Commission on the Status of Women meeting. Cheers and wild applause erupted when the accord was announced in the UN headquarters late Friday.
Michelle Bachelet, executive director of UN Women, said it had been an "historic" meeting. It was announced straight after that Bachelet would be leaving her post to return to Chile.
"People worldwide expected action, and we didn't fail them. Yes -- we did it," Bachelet said.
UN leader Ban Ki-Moon said UN members had committed "to take action to prevent violence and provide justice and services to survivors" of violence against women, which he called a "global menace" and "moral outrage."
Iran, the Vatican and Russia and other Muslim states had formed what some diplomats had called "an unholy alliance" to weaken a statement calling for tough global standards on violence against women and girls.
They had objected to references to abortion rights and language suggesting that rape includes forcible behavior by a woman's husband or partner.
Egypt's Muslim Brotherhood had called the proposed UN document un-Islamic and warned it would lead to the "complete degradation of society."
But the chief Egyptian official at the meeting, Mervat Tallawy, head of the country's National Women's Council, backed the accord. She said the declaration was needed to counter "a global wave of conservatism, of repression against women."
With Norway and Denmark leading a European alliance with North America calling for tough language, right up to the final hours it had appeared that the meeting could end without an accord.
The last attempt by the UN commission to agree a declaration on violence against women in 2003 ended in failure.
"The commission urges states to strongly condemn all forms of violence against women and girls and to refrain from invoking any custom, tradition or religious consideration to avoid their obligations with respect to its elimination," said the declaration.
It added that states should "devote particular attention to abolishing practices and legislation that discriminate against women and girls, or perpetuate and condone violence against them."
Countries should "address and eliminate as a matter of priority domestic violence," went on the declaration.
The conference had been made more emotive by the Taliban attack in October on 15-year-old Malala Yousafzai for her promotion of girls' education in Pakistan and widely publicized gang rapes in India and South Africa.
The United States welcomed the accord. It was an important first step to ensure that women and girls "live productive and safe lives, free from the scourge of violence and abuse," senior US envoy Terri Robl told the meeting.
But she added that "some important aspects" were omitted from the document and the United States believes the declaration should have clearly stated that it applied to lesbian women. "We regret that some delegations prevented this recognition explicitly," Robl said.
Germany's UN ambassador Peter Wittig said the document was "balanced and strong." Wittig tweeted that the declaration "sends a much needed message to the women around the world: your rights are crucial."