The resolution required a two-thirds majority in order to pass. Haley sought to have a simple majority suffice, but a resolution was passed by the body that changed the requirement to a majority of two-thirds.
In total, 87 nations voted in favor of the resolution while 57 voted against it and 33 abstained.
Haley will step down from her position at the end of the year. Since she began representing the United States at the UN, she has pushed back on countries critical of Israel and explicitly cited "anti-Israel bias" as the reason for the US withdrawal from the UN Human Rights Council earlier this year.
The UNGA, comprising 193 nations, has never condemned Hamas, the ruling party in the Gaza strip since 2007.
The US-sponsored resolution would condemn the group for firing rockets into Israel, which it did in November after Israel violated a ceasefire agreement by assassinating a commander of the Hamas military wing al-Qassam Brigades, as well as other fighters.
The European Union backed the US measure to condemn Hamas, giving Haley a much-needed 28 vote boost for her resolution.
Haley sent a letter to every UN mission on Thursday stating that the "United States takes the outcome of this vote very seriously."
"Hamas uses torture and arbitrary arrests to punish its political opponents. It has made Gaza a police state, all while Hamas spends its resources — including UN resources — on rockets and terror tunnels," Haley said during her remarks ahead of the vote. "The question before us now is whether the UN thinks terrorism is acceptable if, and only if, it is directed against Israel."
The resolution "condemns Hamas for repeatedly firing rockets into Israel and for inciting violence," demands that "Hamas and other militant actors, including Palestinian Islamic Jihad, cease all provocative actions and violent activity, including by using airborne incendiary devices," and "encourages tangible steps" towards reuniting "the Gaza Strip and the West Bank under the Palestinian Authority."
It was widely believed that Haley hoped the passage of the resolution would be her defining moment at the UN. "She would like to go out with something," a diplomat for the UN Security Council told AFP. It was also expected that the resolution would pass.
UNGA resolutions are nonbinding but signify the political priorities of UN member states.