The United Nations Human Rights Council will appoint an independent investigator to help protect homosexuals and transgender people worldwide from violence and discrimination.
The UN expert, yet to be named, will have a three-year mandate.
The resolution was adopted after a four-hour debate which resulted in a vote of 23 states in favour and 18 against, with six abstentions.
There were strong objections from Saudi Arabia and Muslim countries while the United States and major European countries backed the resolution.
British Ambassador Julian Braithwaite told delegates the Council regularly – and rightly – passes resolutions on racism, women and children.
“Yet, on this issue, we often hear of culture and tradition as reasons to justify violence against individuals based on their sexual orientation and gender identity,” he said.
“This affects people in this room, and people in my team who are LGBT.
“Are you saying it is okay to discriminate against them based on their sexual orientation and gender identity? To hit, torture, or possibly kill them?”
Saudi Ambassador Faisal Trad argued against what he called “the imposition of certain ideas” and said the new post would open up a “Pandora’s box” while ignoring cultural and religious specificities.