PROVIDENCE, R.I. — Less than a week after same-sex marriage was legalized in New York, the Rhode Island State Senate on Wednesday evening approved a bill allowing not marriage, but civil unions for gay couples, despite fierce opposition from gay rights advocates who called the legislation discriminatory.

The bill, which already passed in the state’s House of Representatives and which the governor said he was likely to sign, grants gay and lesbian couples most of the rights and benefits that Rhode Island provides married couples. It was offered as a compromise this spring after Gordon D. Fox, the openly gay speaker of the Democratic-controlled House, said he could not muster enough votes to pass a same-sex marriage bill.

Gay marriage advocates initially had high hopes for success in Rhode Island this year. The new governor, Lincoln D. Chafee, an independent, had championed their cause, and Mr. Fox, who became speaker last year, also appeared eager to get a marriage bill passed. The state’s two closest neighbors, Connecticut and Massachusetts, allow gay couples to marry, as do New Hampshire and Vermont.

But M. Teresa Paiva Weed, a Democrat and the State Senate president, opposes gay marriage, and Mr. Fox ultimately threw his support to civil unions, saying that was a more realistic goal.