The law legalizing gay marriage in Spain has cleared its last bureaucratic formality -- being published in an official government registry -- and will take effect on Sunday.

An official of the ruling Socialist Party, which sponsored the law, said the party will now seek legislation to protect Spain's estimated 8,000 transsexuals.

The gay marriage law, passed Thursday by the lower house of parliament, was published Saturday in the gazette, the Boletin Oficial del Estado, which records all government decisions in Spain. The document specified that the new law would go into effect Sunday.

The law was signed by King Juan Carlos and Prime Minister Jose Luis Rodriguez Zapatero.

Gay couples are not expected to start getting married until late this month because of the paperwork needed before they go to town halls and other civil bodies that marry people in Spain, according to Spain's main federation of gay men and lesbians.

The law gives same-sex couples the right to wed, adopt children and inherit each other's property, making their legal status the same as that of heterosexual couples.

Spain is the third country in the world to grant full recognition to gay marriage. The others are the Netherlands and Belgium. Canada is expected to enact similar legislation later this month.

Several European countries and a few U.S. states recognize civil unions among same-sex couples, but this falls short of treating them like married couples.

Fierce criticism of the law from the Catholic Church continued, with the head of the Spanish Bishops Conference, Bishop Ricardo Blazquez, branding the measure unconstitutional.