Argentina's Congress has legalised abortions up to the 14th week of pregnancy, a ground-breaking move for a region that has some of the world's most restrictive termination laws.
Senators voted in favour of the bill after a marathon session with 38 in favour, 29 against and one abstention.
Until now, abortions were only permitted in cases of rape or when the mother's health was at risk.
The bill had been approved by the Chamber of Deputies earlier this month.
The Catholic Church, which remains highly influential in Latin America, had opposed the move, calling on senators to reject the bill supported by centre-left President Alberto Fernández.
Pro-choice activists hope the passing of the law in Argentina - one of the largest and most influential countries in the region - will inspire other countries to follow suit.
Large crowds of campaigners both for and against abortion had gathered outside Congress in the capital Buenos Aires, following the debate on huge screens.
When the vote finally happened in the early hours of Wednesday, there was jubilation in the pro-choice camp.
A major step in a conservative region
While Argentina's powerful Catholic Church, and its growing evangelical community, put up strong opposition against this bill, it was Argentina's mighty "green wave" women's movement that has been at the forefront of this change.
A grassroots feminist movement that has grown in influence in the past few years, its campaigning prevailed, overturning a law that had been in place since 1921.
What has happened in Argentina has been closely watched across the region.
With Argentina now legalising abortion up to 14 weeks, activists in major neighbours like Chile and Brazil will no doubt use this precedent to help their cause in rewriting the law in their countries and allow broader reproductive rights in a region known for tough restrictions on abortion.
Long fought for change
Activists have campaigned for a change in the law for years. The passing came two years after senators narrowly voted against legalising abortion.
President Fernández had made reintroducing it one of his campaign promises. "I'm Catholic but I have to legislate for everyone," he argued.
The president also said providing free and legal abortions up to the 14th week of pregnancy was a matter of public health as "every year around 38,000 women" are taken to hospital due to clandestine terminations and that "since the restoration of democracy [in 1983] more than 3,000 have died".
Alongside the legalisation of abortion, Senators also voted in favour of a bill dubbed the "1,000-Day Plan", which will provide better healthcare for pregnant women and mothers of young children.
After the vote, President Fernández tweeted: "Today, we're a better society, which widens women's rights and guarantees public health."
Vilma Ibarra, who drafted the law, was overcome with emotion as she spoke to reporters after it passed. "Never again will there be a woman killed in a clandestine abortion," she said, crying.
The vote had been predicted to be extremely tight but in the end, all four senators who had said they were undecided voted in favour of the legislation after a 12-hour debate.
Senator Silvina García Larraburu voted against the bill in 2018 but backed it this time. Speaking during the debate she said, coming close to tears: "My vote is in favour of free women, of women who can decide according to their own conscience."
Anti-abortion activists, who followed the proceedings but were separated from pro-choice activists by barriers, were dejected.
"The interruption of a pregnancy is a tragedy. It abruptly ends another developing life," said Inés Blas, a senator who voted against the law.
But Argentina's Women's Minister, Elizabeth Gómez Alcorta, said that "we're making history" and many of the pro-choice activists said they hoped it would set a signal for other lawmakers across Latin America.
Abortions are completely banned in El Salvador, Nicaragua and the Dominican Republic and only allowed in certain restricted circumstances in most other Latin American nations.
In the wider region, only Uruguay, Cuba, Guyana and parts of Mexico currently allow women to request an abortion, with varying limits on the number of weeks of pregnancy in which an abortion is legal.
The director of the Americas Division of Human Rights Watch, José Miguel Vivanco, said that he thought that the new law "could have a domino effect in the region".