The ruling, for the northern state of Coahuila, prevents women from being prosecuted for getting an abortion.
Abortion is currently severely restricted in all but four of the country’s states.
Supreme Court Justice Luis Maria Aguilar described the move as a “historic step for the rights of women”.
On Tuesday, the court ordered the state of Coahuila to remove sanctions for abortion from its criminal code.
The decision could pave the way for the decriminalisation of abortions across the country.
Currently, abortion is only legal in a handful of states, except in cases of rape or where the mother’s life is in danger.
A judicial source said the ruling will affect the whole of Mexico, allowing women in states where abortion is criminalised to undergo the procedure with a judge’s order.
The Information Group on Reproductive Choice (GIRE), which campaigns for abortion rights, described the decision as “historic”.
“We hope that throughout the country women and people with the ability to carry a child have the conditions and freedom to determine their reproductive destiny,” it said.
Coahuila borders the US state of Texas, where the Supreme Court allowed a state law banning all abortions after six weeks of pregnancy.
The ruling could open up avenues for people from Texas seeking legal abortions.