Chilean President Sebastian Pinera today signed a law legalising same-sex marriage, two days after the congress approved a bill opposed by one of the frontrunners in next week's elections to replace him.

With the new law, Chile joined about 30 countries in the world, and just a handful in majority Catholic Latin America, where same-sex couples can legally tie the knot. In Chile, they can now also adopt children.

"Today the time has come for marriage equality in our country, the time has come to deepen the values of freedom and dignity," Mr Pinera said as he signed the historic bill at the seat of government in Santiago.

"The time has come to consecrate the freedom to love and to form a family, and the time has come to give full value to the dignity of all relationships of love and affection between two people," he added.

Same-sex marriages can start taking place three months after the law's publication in the official government gazette.

In Latin America, same-sex couples could until now get married only in Costa Rica, Ecuador, Colombia, Brazil, Uruguay and Argentina, as well as in 18 of Mexico's 32 states.

Chile legalized same-sex civil unions in 2015 and has been awaiting the passage of the marriage bill since then-president Michelle Bachelet sent it to Congress in 2017.

In a surprise move, her conservative successor Mr Pinera announced in June he would seek the urgent passage of the bill - supported by a majority of Chileans - through congress.

This happened on Tuesday.

The issue deeply divides the two candidates headed for a presidential run-off on 19 December.

Gabriel Boric, 35, who represents a leftist alliance that includes the Communist Party, supported the bill and voted "yes" in his capacity as lawmaker.

But 55-year-old far-right candidate Jose Antonio Kast, who won 28% of first-round votes compared to Mr Boric's 26%, campaigned against it.