(CNN) -- Argentina became the first Latin American country on Thursday to legalize same-sex marriage.

Lawmakers in the Senate passed the bill after 14 hours of debate that began Wednesday and carried well into early Thursday morning, the state-run Telam news agency reported.

The bill had already passed the lower chamber of Congress.

It gives same-sex couples equal marriage rights, including the ability to adopt children.

The law was backed by the center-left government of President Cristina Kirchner, who has said she will sign it.

The majority Roman Catholic country follows a few others around the world where same-sex marriage is legal. Among them are the Netherlands, Belgium and Spain.

Last month's congressional vote and Wednesday's Senate vote are the latest moves in a pro-gay marriage trend in Argentine politics.

Last year, a judge in Buenos Aires ruled that a ban on same-sex marriage was illegal, paving the way for such marriages in the capital of Argentina.

An injunction by another judge stopped what would have been the first same-sex marriage there.

Ultimately, Latin America's first same-sex marriage happened in Argentina in a southern state with a pro-gay marriage governor.