Mexico's Supreme Court has upheld an amendment to Baja California's state constitution that stipulates life begins at conception, in a move hailed by anti-abortion campaigners.
Although seven of the 11 justices deemed the measure unconstitutional, eight votes were needed to overturn it.
More than half Mexico's 31 states have enacted right-to-life amendments that severely restrict abortions.
However, Mexico City allows abortions in the first 12 weeks of pregnancy.
Anti-abortion campaigners cheered after hearing the Supreme Court ruling.
"We have to continue working so that life may triumph," Jorge Serrano, leader of an anti-abortion organisation Pro-Life, told Reuters.
The Supreme Court is due to consider a similar amendment in the state of San Luis Potosi, where the law also says that life begins at conception.
Justice Fernando Franco proposed the motion to declare Baja California's law unconstitutional but the opposition of four judges sank the measure.
Giving their ruling, the justices said they based their analysis "strictly on constitutional issues. That is, the issue under debate was the power of states to legislate on topics that are not expressly determined by the federal constitution".
However, some women's rights activists fear that allowing individual states to decide their own rules may create a divide between those able to go to Mexico City for a legal abortion and those living in states where it is largely restricted.
Mexico City government's Human Rights Commission said the court's stance would worsen the serious public health problem of clandestine abortions.
The ruling highlights the difference between policies pursued by Mexico City's authorities and more conservative administrations in other states, correspondents say.
All Mexican states allow abortion when pregnancy results from rape and most permit it when the woman's life is in danger.
But pro-choice campaigners say that in practice this does not always happen.