The United States and Israel boycotted the event.
A resolution endorsing the declaration received 142 votes in favour and 10 against while 12 countries abstained.
The vote comes ahead of a meeting of world leaders on September 22 on the sidelines of the high-level UN General Assembly where Australia, the United Kingdom, France, Canada and Belgium - who all voted in favour on Friday - are expected to formally recognise a Palestinian state.
The declaration endorsed by the 193-member General Assembly condemns the attacks against Israel by Palestinian militants Hamas on October 7, 2023 which triggered the war in the Gaza Strip.
It also condemns the attacks by Israel against civilians and civilian infrastructure in the Gaza Strip, siege and starvation "which have resulted in a devastating humanitarian catastrophe and protection crisis".
French Foreign Minister Jean-Noel Barrot said the resolution secured the international isolation of Hamas.
"For the first time today, the United Nations adopted a text condemning it for its crimes and calling for its surrender and disarmament," he said in an X post.
The resolution was supported by all Gulf Arab states.
Israel and the United States voted against it along with Argentina, Hungary, Micronesia, Nauru, Palau, Papua New Guinea, Paraguay and Tonga.
The declaration endorsed by the resolution says the war in the Gaza Strip "must end now" and support the deployment of a temporary international stabilisation mission mandated by the UN Security Council.
"In the context of ending the war in Gaza, Hamas must end its rule in Gaza and hand over its weapons to the Palestinian Authority," the declaration says.
The United States described the vote as "yet another misguided and ill-timed publicity stunt" that undermined serious diplomatic efforts to end the conflict.
"Make no mistake, this resolution is a gift to Hamas," US diplomat Morgan Ortagus told the General Assembly.
"Far from promoting peace, the conference has already prolonged the war, emboldened Hamas and harmed the prospects of peace in both short and long term."
Israel, which has long criticised the UN for not condemning Hamas by name for the October 7 attacks, dismissed the declaration as one-sided and described the vote as theatre.
"The only beneficiary is Hamas …When terrorists are the ones cheering, you are not advancing peace; you are advancing terror," Israel's UN ambassador Danny Danon said.
The October 7, 2023, Hamas attack on Israel killed 1200 people, mostly civilians, and about 250 were taken hostage, according to Israeli tallies.
More than 64,000 people, also mostly civilians, have since been killed during the war in the Gaza Strip, according to local health authorities.
Israeli strikes killed at least 40 Palestinians in the enclave on Friday, local authorities said, most of them in Gaza City, where many residents are staying put despite Israeli orders to leave because they have nowhere safe to go.
Israel has stated its intention to take full control of the ruined city, where about a million people are sheltering, as part of its plan to wipe out Hamas, and has been intensifying its attacks.
The army said it had completed five waves of air strikes on Gaza City this week, targeting more than 500 sites, and that it had destroyed reconnaissance and sniper sites, buildings containing tunnel openings and weapons depots.
In a statement, it said it would "continue to intensify the pace of strikes in a focused manner, based on precise intelligence, with the aim of hitting Hamas' infrastructure".
with AP