The capital's municipal assembly, controlled by left-wing legislators, voted for the measure 43-17 as hundreds of rival protesters demonstrated noisily outside the building.
The move paves the way for same-sex civil unions in the city of 8.6 million people early next year.
The local congress in the northern state of Coahuila, bordering Texas, began debating a similar plan to legalize gay unions this week.
"These reforms are going to cause a snowball effect that no one will be able to stop," said David Sanchez of the left-wing Party of the Democratic Revolution, one of the few openly gay national congressmen.
The measures in Mexico City and Coahuila are modeled on France's civil code and provides property, pension, inheritance and even co-parenting rights. But they stop short of allowing full marriage or adoption of children.
Outside the assembly hall, gay activists with rainbow-color flags and Christian opponents of the law exchanged barbs.
"It's anti-natural. They are descending into something that is against humanity. Societies have always fallen into decadence when there has been homosexuality and disruption in the family," said protester Humberto Muniz.
Authorities in Mexico's powerful Catholic Church have condemned gay union. Some 90 percent of Mexico 107 million people are Catholics and conservative evangelical groups are also winning adherents. Only Brazil has more Catholics.
© Reuters 2006. All Rights Reserved.
While it stops short, at least it's a start and is on the books.
And, an...interesting resource HERE