The Uruguayan senate has voted to decriminalise abortion in the first 12 weeks of pregnancy, a rare move for a Latin American country, although Tabare Vazquez, the country's president, is expected to veto the bill.
The country's Roman Catholic Church had fought against the measure, which would make Uruguay only the second country in South America, along with Guyana, to permit abortions in the 12-week timeframe.
The senate voted 17 to 13 to support the bill after the lower house of congress approved it last week in a session interrupted at one point by a bomb threat.
"Whether the president vetoes it or not, it's important that congress has established this right," said Margarita Percovich, a senator from the country's Broad Front ruling coalition.
Congress could override the veto, but support for the bill is not seen as strong enough.
The Roman Catholic church had voiced its "deep discomfort" at the bill and said anyone who participated directly in stopping a pregnancy would be excommunicated.
"It is news to regret, and for that all we can hope for is for President Vazquez to do what he said he would," said Luis del Castillo, the secretary of the Bishops' Conference in Uruguay.
Abortion is currently banned completely in Uruguay, a nation of about 3.3 million people, though an estimated 33,000 are performed each year at a cost of up to $800 each.
Three Uruguayan doctors were sentenced to prison terms earlier this year for performing abortions.
Most countries in Latin America allow abortion only in cases of rape, when the mother's life is in danger or if the foetus has severe deformities.
Only Guyana and also Cuba allow abortions without restrictions in the first period of pregnancy although they are also permitted in Mexico City but banned in the rest of Mexico.