Chile's constitutional court has voted to approve a bill to ease the country's total ban on abortions.
It ruled that terminations are justified after rape, if the mother's life is at risk or if the foetus is not expected to survive the pregnancy.
The law was approved after two years' debate in the Chilean Congress but had been challenged by conservatives.
Chile had been one of seven Roman Catholic countries with an abortion ban in all circumstances.
They are Chile, Honduras, El Salvador, Nicaragua, Malta, The Vatican and Dominican Republic.
Last major hurdle
The current law in Chile was put in place during the military government of Augusto Pinochet.
News of the judges' ruling by 6-4 led to celebrations among left-of-centre and centrist parties in central Santiago. It was also welcomed by women's and rights groups.
The court heard the arguments of more than 130 concerned organisations before making its ruling, which removes the last major hurdle for the bill to become law.
Chile legalised abortion for medical reasons in 1931 but it was banned totally in 1989 under Gen Pinochet.
Lawmakers have since 1991 introduced dozens of bills to ease the restrictions, but all were blocked by right-of-centre parties and the church.
The cause of the reformers was boosted in 2013 with the election of President Michele Bachelet, a keen supporter of a woman's right to choose whether or not to have an abortion. The move to ease abortion restrictions is seen as her swansong as she leaves office.
BBC Latin America analyst Candace Piette says that the ruling is a watershed for reproductive rights in the four countries of Latin America which have a blanket abortion ban.
Even though an estimated 70% of Chileans are in favour of lessening the restrictions, abortion remains deeply controversial.
Under existing legislation, both doctor or patient can face up to five years in prison. In the four years up to 2014, 73 people were jailed.
Recently the courts have tended to order therapy for women instead of prison.
Despite the risks, reproductive rights organisations say up to 70,000 illegal abortions take place every year in Chile.
One of the most common methods is taking a pill intended to treat ulcers or by obtaining pills on the online black market.