The measure has the support of President Sebastian Pinera, who must sign it into law, and will also enable married same-sex couples to adopt children.
The bill got the green light from the upper house of congress, or senate, Tuesday, and was immediately given the final stamp of approval by the lower Chamber of Deputies with 82 votes to 20.
There were two abstentions.
In Latin America, same-sex couples could until now get married only in Costa Rica, Ecuador, Colombia, Brazil, Uruguay and Argentina and in 14 of Mexico’s 32 states.
The country legalized same-sex civil unions in 2015, and has been eagerly awaiting the legalization of gay marriage since then-president Michelle Bachelet sent a bill to Congress in 2017.
In a surprise move, her conservative successor, Pinera, announced in June he would seek the urgent passage of the bill — which has the backing of a majority of Chileans — through Congress.
The project has been consistently opposed by the most conservative bloc of Chile’s ruling right wing, but has nevertheless obtained a majority “yes” vote at every step of the process in an opposition-dominated congress.
The issue deeply divides the two candidates headed for a presidential run-off on December 19.
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 percent of first-round votes compared to Boric’s 26 percent, campaigned against it.