The state Senate voted 24-18 for the repeal bill, sending it to Gov. Bill Richardson for his signature.
Richardson has opposed repeal in the past but now says he would consider signing it.
"I have met with many people and will continue to consider all sides of the issue before making a decision," the second-term Democratic governor said in a statement issued after the vote.
He would have three days — excluding Sunday — to make a decision once the bill reaches his desk.
The House approved the legislation a month ago.
"The tide is turning across the country, and we are part of that tide," said Ruth Hoffman, director of Lutheran Advocacy Ministry and a longtime lobbyist against the death penalty.
The vote capped a decade of repeal efforts in New Mexico, one of 36 states with capital punishment.
"For a state to look ahead and say the death penalty is not serving the people's needs is a very courageous thing to do," said Richard Dieter, executive director of the Washington, D.C.-based Death Penalty Information Center.
The vote also was hailed by Amnesty International USA, with executive director Larry Cox calling New Mexico "a trailblazer and a beacon of hope for everyone who believes in human rights and justice."
There are two men on New Mexico's death row. Their sentences would not be affected by repeal.
The state has executed one man in the past 49 years, convicted child killer Terry Clark in 2001.
New Jersey banned executions in 2007, the first state to do so since the U.S. Supreme Court reinstated the death penalty in 1976.
New Mexico was one of several states considering banning executions this year.
Repeal legislation has passed the state Senate in Montana and awaits a House hearing. The state Senate in Kansas is expected to debate a repeal bill on Monday.