Uruguay's legislature voted to allow same-sex marriages nationwide, making it only the second Latin American country to do so.

The vote, with 71 of the 92 members of the lower house backing the measure, was welcomed with cries of "freedom, freedom" and "equality" from members of the public who burst into applause.

The senate last week approved a bill legalizing marriage between "two people of different or the same sex."

"Tomorrow, we will have a more just, more equal society with more rights for everyone," said Sebastian Sabini, a lawmaker from the Frente Amplio ruling coalition.

Uruguay's move came after Argentina approved gay marriage in 2010. Same-sex marriage has been permitted in Mexico City since 2009.

The Catholic Church appealed during Easter week for the defense of the institution of marriage, but only eight opposition senators voted against the bill, while 23 voted in favor.

Over the past six years, Uruguay has legalized civil unions for homosexuals and the adoption of children by same sex couples, and opened the military to gays.

The new law allowing same-sex marriage also includes other changes that apply to all regardless of sexual orientation. The minimum age for legal marriage will increase to 16 for all instead of the current 12 for women and 14 for men.

Same-sex couples who adopt will be allowed to choose the order in which a child uses family names.

The new law will take effect 90 days after its enactment.