Argentina has become the first country in Latin America to legalize gay marriage.
The Senate passed the bill early Thursday morning after more than 15 hours of debate. Demonstrators for and against the new law spent the night outside Congress while they waited for the result.
Lawmakers voted 33 - 27 in favor of the new legislation, which gives same-sex couples the same legal rights and protections as male-female couples.
The legislation will also allow adoptions by same-sex couples.
The measure was strongly opposed by the Catholic Church, among other groups.
But the lower house of congress passed the measure two months ago, and President Cristina Kirchner has already voiced her support, so the Senate vote was the last legal hurdle.
Supporters say the new law is a victory against oppression of minorities.
In recent months, five same-sex couples have married in Argentina, after receiving the legal authorization to do so. Gay marriage is not specifically recognized under Argentine law.
Opposition to gay and lesbian unions remains strong throughout Latin America, although some cities have taken steps on their own.
Buenos Aires was the first city in the region to approve same sex civil unions in 2002, followed by a handful of other cities in Mexico and Brazil. Uruguay is the only country to approve civil unions nationwide.
Some information for this report was provided by AP and AFP.