The debate over the legislation reflected deep divisions in Argentina, which is a mainly Roman Catholic country.
BBC Mundo looks at the key aspects of the law and the situation across Latin America:
What does the law consist of?
The law foresees a modification of article 2 of the Argentine Civil Code, which establishes matrimony as being between two individuals of different gender.
The new legislation will replace the expression "man and woman" with "couple".
Homosexuals will have exactly the same rights as heterosexuals.
This includes the right to adopt, which was one of the most controversial aspects of the proposed bill, inheritance, pension rights and other rights relating to social security.
When does the law come in to force?
The law will take effect when it has been published in the official gazette, which could take a couple of days.
What is the difference between civil union and marriage?
Civil partnerships bestow many but not all of the rights and obligations of marriage.
The scope of same-sex marriage and civil union laws vary from country to country.
For example, Portugal's gay marriage law does not allow adoption, while Uruguay's civil partnership legislation does.
However, the difference in scope is not just legal but often has a significant symbolic and cultural component.
For those who support same-sex marriage, it is a historic advance that grants rights to people irrespective of sexual orientation.
For those opposed, recognising same-sex unions as marriage undermines the traditional concept of family.
Where else is same-sex marriage recognised?
Just a handful of countries recognise gay marriage - see box.
In the US, same-sex couples can marry in five states and in Washington DC.
Some of the countries that recognise civil partnerships are: Andorra, Australia, Austria, Czech Republic, Denmark, Slovenia, Finland, France, Hungary, Iceland, Israel. Luxembourg, New Zealand, Switzerland and the United Kingdom.
What is the situation in the rest of Latin America?
Mexico City until now had been the only place in Latin America where homosexuals had the same rights as heterosexual couples to marry and adopt children.
Uruguay allows gay people to adopt children but not to marry.
In Chile, the government is drawing up proposals which would grant homosexual couples the same rights as heterosexual couples regarding their finances, including pension rights, and being recognised as next of kin.
However, Chilean President Sebastian Pinera has said that civil unions would not under any circumstances be equivalent to marriage.
Brazilian President Luiz Inacio Lula da Silva has indicated he backs the legalisation of civil unions. However, various legislative proposals regarding this have failed in Brazil, which has the world's biggest Catholic population.
Other countries, such as Colombia, do not recognise gay marriage but do offer civil guarantees, including the right to draw a pension if one partner dies.
In the majority of Central American and Caribbean countries there are no major legal or social initiatives regarding gay marriage or civil partnerships.
In Costa Rica, however, gay rights activists and some deputies have backed a proposed bill to guarantee civil rights.
There was a proposal in Cuba in 2006 to recognise "legal unions" but it did not advance.
Cesar Cigliutti, president of the Argentine Homosexual Community, told BBC Mundo he expected to Argentina's decision have a "domino effect" across  Latin America.
Argentina has become the first country in Latin America to legalise same-sex marriage.