The Costa Rican Legislative Assembly was debating a larger bill and the conservative majority passed the measure, which liberal lawmakers had modified to include language stipulating the government should confer the same right for gay relationships as heterosexual couples, essentially opening the door to gay civil unions.
Realizing their mistake, conservatives immediately called on President Laura Chinchilla to veto the bill.
Chinchilla has said she does not oppose gay marriage or civil unions if the courts allow it but hasn't pressed for the measure because she didn't campaign on the issue.
She didn't immediately say whether she planned to veto the legislation, the Tico Times said Saturday.
Liberal lawmakers said they altered the bill legally and without objection though conservatives slammed the bill -- and gay marriage -- after its passage.
If the legislation is signed into law and survives a likely court challenge, Costa Rica would join Brazil, Colombia and Ecuador in recognizing gay civil unions. Uruguay and Argentina allow gays and lesbians to marry.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Ray Liotta sues skin care company over use of likeness