Buenos Aires, Argentina (CNN)  Argentina’s Senate vote is seen as a major victory for abortion rights advocates in the Catholic-majority country.

The Senate voted 38-29 to give millions of women access to legal terminations under a new law supported by President Alberto Fernández. The margin was expected to be much smaller.

Massive crowds of abortion rights activists and anti-abortion campaigners gathered outside the Palace of the Argentine National Congress to await the results, which came in the early hours of the morning after an overnight debate. Supporters of the bill greeted the news with loud cheers — and, in some cases, tears of joy.

Gabriela Giacomelli, whose two sisters had illegal abortions, called the scene “very emotional.”

“We have been fighting for years,” Giacomelli said. “I see young people now, though I hope they never have to abort, but if they do now they can do it safely.”

Abortion rights activists celebrate after the Senate approved a bill to legalize abortion outside Congress in Buenos Aires on Wednesday morning.

Mariela Belski, executive director of Amnesty International Argentina and an ambassador for the global women’s rights movement She Decides, said: “Today, Argentina has made an emblematic step forward in defending the rights of women, girls and people with reproductive capacity.”

The law will legalize abortion in all cases up to 14 weeks of pregnancy. Abortion in Argentina, South America’s third-most populous country, is currently only permitted when a pregnancy results from rape or endangers the life or health of the woman.

In all other circumstances, abortion is illegal and punishable by up to 15 years in jail.

Abortion advocates hope Argentina’s decision will spur similar movements in Latin America’s other Catholic-majority states.

Belski said that the move sends “a strong message of hope to our entire continent — that we can change course against the criminalization of abortion and against clandestine abortions, which pose serious risks to the health and lives of millions of people. Both the law passed by the Argentine Congress today and the enormous effort of the women’s movement to achieve this are an inspiration to the Americas, and to the world.”

Across Latin America and the Caribbean region, only Cuba, Uruguay, French Guiana and Guyana allow for elective abortions, according to the Center for Reproductive Rights. In Mexico City and the Mexican state of Oaxaca, abortions are also available on request, but are severely restricted throughout the rest of Mexico.

By contrast, El Salvador, the Dominican Republic, Haiti, Honduras, Nicaragua and Suriname ban abortions in nearly all circumstances. Colombia, Costa Rica, Guatemala and Panama allow for abortion only if it’s to preserve the woman’s health or help save her life.

While abortions remain largely restricted or illegal throughout the region, approximately 5.4 million abortions took place in Latin America and the Caribbean between 2015 and 2019, according to data from the Guttmacher Institute. Its research has found that unintended pregnancy rates are highest in countries that restrict abortion access and lowest in countries where abortion is broadly legal.

An anti-abortion campaigner reacts after the Senate voted in favor of a bill to legalize abortion on Wednesday.