The resolution required two-thirds support and while Assembly resolutions are non-binding, they can carry political weight. The US text received 87 votes in favor, 58 against, 32 abstentions and 16 countries did not vote.
In an earlier procedural move requested by Kuwait, the 193-member body narrowly voted to require two-thirds support and not a simple majority for adoption of the draft resolution.
Outgoing US Ambassador to the United Nations Nikki Haley had written to member states on Monday to urge them to vote for the US-drafted text, warning them: "The United States takes the outcome of this vote very seriously."
Haley, who will step down at the end of the year, has been a staunch defender of Israel.
"Before the General Assembly can credibly advocate compromise and reconciliation between the Palestinians and Israel, it must on record, unambiguously and unconditionally, condemn Hamas terrorism," Haley told the body before the vote.
The United States is working on a long-awaited plan to broker peace between Israel and the Palestinians, but the Palestinians are skeptical and have accused the Trump administration of siding with Israel on core issues.
US Secretary of State Mike Pompeo slammed the UN for rejecting his country's draft resolution.
"Following Just days after Hamas indiscriminately fired thousands of missiles at Israel’s citizens, UN could not muster a resolution condemning this band of terrorists. This is yet another disgraceful act of bias toward the Jewish State," Pompeo tweeted.
Hamas official Sami Abu Zuhri told Reuters that "rejecting the American drafted resolution against the resistance represents a blow to the American administration and reaffirms the legitimacy of the resistance."
Prime Minister Benjamin Netanyahu commended the 87 countries that voted in favor.
"While it did not achieve a two-thirds majority, this is the first time that a majority of countries have voted against Hamas and I commend each of the 87 countries that took a principled stand against Hamas," Netanyahu tweeted.
Israel's UN Ambassador Danny Danon said the countries that rejected the draft resolution should be ashamed.
For more than a decade Gaza has been controlled by Hamas under an Israeli-Egyptian blockade. The economy has collapsed, creating what the World Bank describes as a humanitarian crisis with shortages of water, electricity and medicine.
Israel says it has no choice but to enforce its blockade to defend itself against Hamas, which calls for Israel's destruction and has used Gaza as a base for missile attacks.
Iran's Deputy UN Ambassador Eshagh Al Habib accused the United States of trying to deflect the attention of the world from the root causes of the conflict and said "we recognize Hamas as a legitimate resistance movement fighting for the liberation of Palestinian territory from foreign occupation."
Itamar Eichner contributed to this report.