The resolution also calls on Myanmar to stop the incitement of hatred against the Rohingya and other minorities.
Thousands of Rohingya were killed and more than 700,000 fled to neighbouring Bangladesh during an army crackdown in the Buddhist-majority country in 2017.
Myanmar (formerly Burma) insists it was tackling an extremist threat.
Earlier this month, the country's leader Aung San Suu Kyi rejected allegations of genocide at the UN International Court of Justice (ICJ).
The UN resolution passed on Friday expressed alarm at the continuing influx of Rohingya to Bangladesh over the past four decades "in the aftermath of atrocities committed by the security and armed forces of Myanmar".
It highlighted the findings of an independent international mission "of gross human rights violations and abuses suffered by Rohingya Muslims and other minorities" by Myanmar's security forces, which the mission described as "the gravest crimes under international law".
The resolution called on Myanmar to protect all groups and to ensure justice for all violations of human rights. It was passed by a total of 134 countries in the 193-member world body, with nine votes against and 28 abstaining.
UN General Assembly resolutions are not legally binding but can reflect world opinion.
The UN ambassador for Myanmar, Hau Do Suan, called the resolution "another classic example of double-standards [and] selective and discriminatory application of human rights norms".
He said it was designed to exert "unwanted political pressure" on Myanmar and did not attempt to find a solution to "the complex situation in Rakhine state".
The Gambia, a small Muslim-majority west African nation, brought the Rohingya case to the ICJ on behalf of dozens of other Muslim countries.
Addressing the court earlier this month, Nobel Peace Prize laureate Aung San Suu Kyi called the case against Myanmar "incomplete and incorrect". She said troubles in Rakhine, where many Rohingya lived, went back centuries.
Ms Suu Kyi said the violence was an "internal armed conflict" triggered by Rohingya militant attacks on government security posts. She conceded that Myanmar's military might have used disproportionate force at times, but said that if soldiers had committed war crimes "they will be prosecuted".
More about: Rohingya