The treaty was adopted by a vote of 122 in favor with one country, NATO member The Netherlands voting against, while Singapore abstained.
Loud applause and cheers broke out in the UN conference hall following the vote that capped three weeks of negotiations on the text providing for a total ban on developing, stockpiling or threatening to use nuclear weapons.
Nuclear-armed states have dismissed the ban as unrealistic, arguing it will have no impact on reducing the global stockpile of 15,000 atomic weapons.
"Is there anyone that believes that North Korea would agree to a ban on nuclear weapons?" asked US Ambassador Nikki Haley when negotiations began in March. "There is nothing I want more for my family than a world with no nuclear weapons, but we have to be realistic."
But supporters hailed a historic achievement.
"We have managed to sow the first seeds of a world free of nuclear weapons," said Costa Rica's ambassador, Elayne Whyte Gomez, the president of the UN conference that negotiated the treaty.
Led by Austria, Brazil, Mexico, South Africa and New Zealand, 141 countries joined in drafting the treaty that they hope will increase pressure on nuclear states to take disarmament more seriously.
None of the nine countries that possess nuclear weapons, the United States, Russia, Britain, China, France, India, Pakistan, North Korea and Israel, took part in the negotiations or the vote.
Even Japan, the only country to have suffered atomic attacks, in 1945, boycotted the talks as did most NATO countries.
No more prestige
Nuclear powers argue their arsenals serve as a deterrent against a nuclear attack and say they remain committed to the nuclear Non-Proliferation Treaty (NPT).
The decades-old NPT seeks to prevent the spread of atomic weapons but also puts the onus on nuclear states to reduce their stockpiles.
Impatience however is growing among many non-nuclear states over the slow pace of disarmament as are worries that weapons of mass destruction will fall into the wrong hands.
Disarmament campaigners say the treaty will go a long way in increasing the stigma associated with nuclear weapons and will have an impact on public opinion.
"The key thing is that it changes the legal landscape," said Richard Moyes, director of the British-based organization Article 36.
"It stops states with nuclear weapons from being able to hide behind the idea that they are not illegal."
"We hope that today marks the beginning of the end of the nuclear age," said Beatrice Fihn, director of the International Campaign to Abolish Nuclear Weapons.
"It is beyond question that nuclear weapons violate the laws of war and pose a clear danger to global security. "
Opponents believe the treaty will fail to advance nuclear disarmament.
"We are very critical of this movement because it will give false hopes" and create unreasonable expectations, said a diplomat from a country opposed to the ban.
The treaty will be open for signatures as of September 20 and will enter into force when 50 countries have ratified it. (AFP)