There were twenty-four votes in favor of the bill, named the Marriage Equality Act, and 38 votes against it. Thirty-two votes were needed for passage. The New York State Assembly had already passed the legislation.
The measure needed Republican support because while there are 32 Democrats in the State Senate, some in that party opposed the bill. Among them were Queens Senator Hiram Monserrate and Bronx Senator Ruben Diaz Sr., New York 1 reports. No Republicans backed the bill.
As the Associated Press notes, "the Senate decision Wednesday comes after months of delays and arm twisting of lawmakers sympathetic to the bill but representing conservative districts."
New York Gov. David Paterson, a Democrat facing a difficult election campaign in 2010, strongly backed the bill. A Marist College poll released Wednesday showed 51 percent of those who live in New York state support same-sex marriage, while 42 percent oppose it.
New York also does not allow civil unions, though it does afford gay couples some of the rights granted married couples.
Gay marriage is legal in four states: Connecticut, Iowa, Massachusetts and Vermont. It will become legal in New Hampshire next year, and the District of Columbia city council recently voted to legalize it there.
Last month in Maine, voters struck down a law legalizing gay marriage before it could take effect.
The AP notes that after the vote, gay rights backers chanted, "Equal rights now!"
Eighteen of the lawmakers who supported the legislation spoke in its favor, but only one who opposed the bill spoke in defense of that position.