New Mexico becomes 17th US state to back gay marriage
A same-sex marriage supporter attend a rally on June 26, 2013, in West Hollywood California
Rights activists hailed the opinion, saying it was a "historic and joyful" day for New Mexico and the United States, more than a third of whose states have now legalized same-sex unions.
"As a state, we have always strived to treat all families with dignity and respect, and today’s decision allowing loving, committed same-sex couples to marry continues that tradition," said Laura Schauer Ives, legal director of the American Civil Liberties Union of New Mexico.
Over 1,000 same-sex couples who have already married in New Mexico "can now rest certain knowing their marriages will be recognized and respected by our state," she said.
"This truly is a historic and joyful day for New Mexico."
In its 31-page opinion, the state's top court said: "All rights, protections, and responsibilities that result from the marital relationship shall apply equally to both same-gender and opposite-gender married couples."
"We hold that the state of New Mexico is constitutionally required to allow same-gender couples to marry, and must extend to them the rights, protections and responsibilities that derive from civil marriage under New Mexico law," wrote Justice Edward Chavez.
But state Governor Susana Martinez, known to oppose legalizing gay marriage, said the issue should have been left to voters, while appealing for "respect" for different views.
"My personal views on this issue are well-known, and I'm confident that most New Mexicans believe, like I do, that it should have been settled by a vote of the people," she said.
"While there will surely be intense debate about this decision moving forward, I encourage New Mexicans to continue to respect one another in their discourse... As we move forward, I am hopeful that we will not be divided."
New Mexico joins 16 other US states and the US capital Washington in legalizing same-sex marriage.
The other states are: California, Connecticut, Delaware, Hawaii, Illinois, Iowa, Maine, Maryland, Massachusetts, Minnesota, New Hampshire, New Jersey, New York, Rhode Island, Vermont and Washington.
Marriage laws are governed by individual US states, 29 of which have amended their constitutions to ban same-sex marriage.
Efforts to give same-sex couples the same rights as heterosexuals have gathered steam in recent years.
One of the most important victories was when the US Supreme Court in June struck down the Defense of Marriage Act, which defined marriage as a union between one man and one woman.