The court said it would allow both claimants to “possess, transport and use cocaine” but not sell it, according to Mexico United Against Crime (MUCD).
MUCD, which seeks to end the country’s “war on drugs”, called the ruling a “historic step”.
The decision must be reviewed by a higher court before it is enforced.
MUCD said the Mexico City court ordered the country’s health authority, Cofepris, to authorise the two claimants’ use of cocaine.
A Cofepris official told the AFP news agency that it had taken steps to block the court order, which was handed down in May. The official said that such authorisation would be outside of its legal remit.
The ruling will only come into effect if a panel of judges side with the original decision. If they do approve the ruling, it will only apply to the two people who brought the cases, whose identities were withheld.
In a statement on Tuesday, MUCD said the cases represent “another step in the fight to construct alternative drug policies that allow [Mexico] to redirect its security efforts and better address public health.”
Mexico has long struggled with violent conflict from drug cartels, with thousands of drug-related killings reported in the country every year.
In 2018, the number of drug related homicides in Mexico rose to 33,341, according to the Council on Foreign Relations. The figures were a 15% increase from the previous year.
Mexico’s Supreme Court has already authorised recreational marijuana use in individual cases.
President Andrés Manuel López Obrador, a left-wing politician who took office in December, has promised “radical” changes in the country’s approach to tackling drugs.
He has proposed decriminalising illegal drugs.
Drugs would not be illegal but arrests would be replaced by enforcing treatment such as attending a detox programme.