Uruguay's Senate voted 17-14 on Wednesday in favor of a bill decriminalizing abortion in the first 12 weeks of pregnancy, paving the way for the measure to become law.
The lower house had approved the legislation earlier and President José Mujica has signaled that he will not veto it.
All of the senators from the governing center-left Broad Front coalition voted in favor, joined by one member of the main opposition National Party.
Uruguay is set to become only the second Latin American country, after Cuba, to allow abortion on demand, though with some restrictions.
Other countries in the region permit termination of a pregnancy under certain circumstances, such as rape, risk to the mother or severe fetal defects.
The Senate first passed the bill last December, but had to reconsider the text after it underwent some changes in the lower house.
The debate before Wednesday's vote was shorter than expected and less heated than on previous discussions of the issue.
Couching his opposition to the bill in a defense of "freedom and human rights," Nationalist Sen. Jorge Larrañaga said his party will repeal the law if it wins the 2014 elections.
Senators with the Broad Front criticized the "hypocrisy" of current law, which, they said, does nothing to prevent abortions while forcing women to risk their lives by resorting to clandestine medical procedures.
The bill mandates that a woman wanting to terminate her pregnancy must approach a physician, who will in turn refer her to a panel of psychologists, gynecologists and social workers for advice.
The woman must then reflect on her decision for five days before having the abortion.
Official estimates put the annual number of abortions carried out in Uruguay at a little more than 30,000, while independent groups say the true figure is likely twice that.
Congress approved a similar law in 2008 only to see it vetoed by then-President Tabaré Vázquez, a practicing oncologist who said his conscience did not allow him to sign the measure.
Vázquez was elected as the standard-bearer of the Broad Front and his decision to block decriminalization of abortion provoked outrage in the heart of the governing coalition.