Although sex work is allowed in much of Mexico, states have different and sometimes unclear rules, meaning workers frequently operate in legal vacuums which can leave them vulnerable to exploitation and trafficking.
Mexico City lawmakers have given the green light to decriminalise sex work in the capital, hoping it will be the first step to a crackdown on sex trafficking that traps thousands of Mexican women and children.
Lawmakers in Mexico City's Congress on Friday voted 38-0, with eight abstentions, in favour of a bill to remove a line in the Civic Culture Law which said prostitutes and their clients can be fined or arrested if neighbours complained.
Temistocles Villanueva, a local representative with the ruling centre-left Morena party, said the new law recognised that people had the right to engage in sex work.
"It's a first step that has to lead to regulation of sex work, to fight human trafficking and strengthen the rights of sex workers," he said.
"Exercising sexuality in our country is still a taboo topic that few of us dare to talk about."
Sex work is allowed in much of Mexico but states have different and sometimes unclear rules, meaning workers frequently operate in legal vacuums which can leave them vulnerable to exploitation and trafficking by crime gangs.
Mexico is a source, transit, and destination country for men, women, and children subjected to sex trafficking and forced labour, with Mexican women and children the most at risk from sex trafficking, according to the US State Department.
Mexico is listed as a Tier 2 nation in the US's Trafficking in Persons Report, meaning it does not meet the minimum standards for the elimination of trafficking but it is making significant efforts to do so.
The report said observers had made links between women's disappearances and murders and trafficking by organised criminal groups.
Elvira Madrid, founder of sex work rights group Brigada Callejera said the change to the law was welcome, but now there needed to be a legal framework that protected workers.
Debate over the legal status of sex work in Mexico and elsewhere is controversial, particularly among some anti-slavery groups who argue that decriminalisation provides a cover for human traffickers.
But sex worker and other human rights groups in Mexico say criminalisation only sends the problem deeper underground, and exposes an already vulnerable group to abuses by police and organised crime.
Friday's bill came after an earlier version was criticised by sex worker and human rights groups. Mayor Claudia Sheinbaum's office sent it back to Congress with suggested modifications which were taken up.
Eduardo Santillan, also a Morena Mexico City Congressman, said that now that sex work was decriminalised, anti-trafficking public policy should be strengthened.
"We think that the big challenge of this Congress will be making both of these fundamental principles compatible," he said.