MEXICO CITY — City lawmakers voted Tuesday to legalize abortion in this capital during the first 12 weeks of pregnancy, an action supporters say will serve as a landmark for women's rights in Latin America.

The legislation could result in thousands of Mexican women traveling to the capital for legal abortions. Roman Catholic activists and the leaders of the conservative National Action Party, or PAN, have promised to challenge the law in court.

"Women have self-determination over their bodies," Deputy Daniel Ordoñez said as he formally introduced the bill in the city's Legislative Assembly. "They have the right to decide whether to enter into motherhood. It is a basic right and an exclusive right of women."

Mayor Marcelo Ebrard of the leftist Democratic Revolution Party, or PRD, has promised to sign the bill into law. The party made the legalization of abortion part of its platform in last year's regional and national elections.

Cuba, Puerto Rico and Guyana are the only places in the region that allow abortion on demand. But a subculture of illegal and often unsafe abortions exists in nearly every country of overwhelmingly Catholic Latin America.

PRD supporters said the law was meant to address a widespread and hidden public health crisis: the deaths of thousands of women in Mexico each year as a result of illegal and unsafe abortions.

The bill passed 46 to 19 despite fierce PAN opposition. After the vote, several abortion rights activists in the balcony broke into cheers and a chant of "Yes, we did it!"

"It's going to make an enormous difference for women in Mexico City in their everyday lives," said Lilian Sepulveda, an attorney with the Center for Reproductive Rights in New York specializing in Latin America. "This debate has shifted the focus to the realm of women's health. It's not a taboo anymore. That's progress."

A conservative-backed proposal to delay a vote on the bill and instead schedule a popular referendum was easily defeated. Also defeated was a PAN motion for a minute of silence in honor of "the children who will die" as a result of the legislation.

"A country that accepts abortion is not teaching its people how to love," PAN Deputy Jose Antonio Zepeda said. "It is teaching its citizens how to use violence to obtain what they want."

More than 8 million people live in Mexico City and at least 40 million more within a day's drive. Federal Health Secretary Jose Angel Cordova Villalobos said Tuesday that there was nothing to prevent residents of other Mexican states from coming to the capital to seek legal abortions at private and public clinics.

Cordova, a fierce opponent of abortion, said in a radio interview that the new law would be likely to tie the hands of federal officials in the city. Among other things, doctors probably will be free to establish abortion clinics here.

"They will be like any other facility," Cordova said. "They will have to meet the sanitary conditions to guarantee proper care of the patients."

The legalization vote came after an emotional and often philosophical six-hour debate. Supporters of the bill more than once quoted French feminist Simone de Beauvoir, and opponents cited biologists and international treaties Mexico has ratified, including the Universal Declaration of Human Rights.

"It is undeniable that an individual is a human being from the moment of conception," said PAN Deputy Paula Adriana Soto Maldonado, who maintained that the "right to life, liberty and security of person" outlined in the Universal Declaration of Human Rights also applied to the unborn.

Although Mexico is overwhelmingly Catholic, a recent poll published in the Reforma newspaper showed that 53% of Mexico City residents backed the proposed legislation, whereas 43% opposed it.

"Today is a triumph for democracy," said Maria Consuelo Mejia of Catholics for the Right to Choose. "It is a triumph for all women, and above all for the poorest."

President Felipe Calderon, a member of PAN, had distanced himself from the debate. But his wife, Margarita Zavala, this week joined the chorus of conservative voices calling on legislators to reject the bill. Abortion, she said, "is the rule of the strong over the weak [and] is a denial of our future."

In a letter to Mexican bishops, Pope Benedict XVI urged opposition to the bill, prompting supporters to denounce the "intrusion" of faith into the secular process.

Catholic legislators who favored the bill said they were being bombarded with threatening phone calls and e-mails from anti-abortion activists. Church leaders have said they would excommunicate legislators who voted for it.