The high court ordered that abortion be removed from the federal penal code, in the landmark ruling on Wednesday.
The ruling will require the federal public health service and all federal health institutions to offer abortion to anyone who requests it.
"No woman or pregnant person, nor any health worker, will be able to be punished for abortion," the Information Group for Chosen Reproduction, known by its Spanish initials GIRE, said in a statement.
Mexico City was the first Mexican jurisdiction to decriminalise abortion 15 years ago and others followed suit, but abortion is still criminalised in 20 of the country’s 32 states.
While judges in those states will have to abide by the court’s decision, further legal work will be required to remove all penalties.
Celebration of the ruling soon spilled out onto social media.
"Today is a day of victory and justice for Mexican women!" Mexico’s National Institute for Women wrote in a message on the social media platform X, formerly known as Twitter. The government organisation called the decision a "big step" toward gender equality.
Senator Olga Sanchez Cordero, a former Supreme Court justice, applauded the ruling, saying on X that it represented an advance toward "a more just society in which the rights of all are respected." She called on Mexico's Congress to pass legislation in response.
But others in the highly religious country blasted the decision. Irma Barrientos, director of the Civil Association for the Rights of the Conceived, said opponents will continue the fight against expanded abortion access.
"We're not going to stop," Barrientos said. "Let's remember what happened in the United States. After 40 years, the Supreme Court reversed its abortion decision, and we're not going to stop until Mexico guarantees the right to life from the moment of conception."
The court said on X that "the legal system that criminalized abortion" in Mexican federal law was unconstitutional because it "violates the human rights of women and people with the ability to gestate."
The decision came two years after the court ruled that abortion was not a crime in one northern state. That ruling set off a slow state-by-state process of decriminalising it.
Abortion rights activists will have to continue seeking legalisation state by state, though Wednesday's decision is likely to make that easier.
For now, the ruling does not mean every Mexican women will be able to access the procedure immediately, explained Fernanda Diaz de Leon, sub-director and legal expert for women's rights group IPAS.
But in theory, it obligates federal agencies to provide the care to patients.
Ms Diaz de Leon said removing the federal ban takes away another excuse used by care providers to deny abortions in states where the procedure is no longer a crime.
It also allows women with formal employment who are part of the social security system and government employees to seek the procedure in federal institutions in states where abortion is still criminalised, she said.
Ms Diaz de Leon and officials at other feminist organisations worry women, particularly in more conservative areas, may still be denied abortions.
"It's a very important step," she said. But "we need to wait to see how this is going to be applied and how far it reaches."
Across Latin America, countries have made moves to lift abortion restrictions in recent years, a trend often referred to as a "green wave," in reference to the green bandanas carried by women protesting for abortion rights in the region.
The changes in Latin America stand in sharp contrast to increasing restrictions on abortion in parts of the United States.
The US Supreme Court last year overturned Roe v Wade, the 1973 ruling that provided a right to abortion nationwide. Since then, most states led by conservative lawmakers and governors have adopted bans or tighter restrictions.