The Vatican, under the new leadership of Pope Benedict XVI, has condemned a Spanish government bill allowing marriage between homosexuals.
The bill, passed by parliament's Socialist-dominated lower house, also allows gay couples to adopt.
A senior Vatican official described the bill - which is likely to become law within a few months - as iniquitous.
He said Roman Catholic officials should be prepared to lose their jobs rather than co-operate with the law.
The bill would make Spain the first European country to allow homosexual people to marry and adopt children.
Only Belgium and the Netherlands allow same-sex marriages. It is also a dramatic step in the rapid secularisation of what was once one of the most devoutly Roman Catholic countries in Europe.
The head of the Vatican's Pontifical Council on the Family, Cardinal Alfonso Lopez Trujillo, denounced the legislation as profoundly iniquitous.
Interviewed in the Italian newspaper, Corriere de la Sera, Cardinal Lopez Trujillo said the Church was making an urgent call for freedom of conscience for Roman Catholics and appealing to them to resist the law.
He said every profession linked with implementing homosexual marriages should oppose it, even if it meant losing their jobs.
The cardinal insisted that just because something was made law it did not make it right.
Socialist Prime Minister Jose Luis Rodriguez Zapatero took office a year ago making it clear he intended to remove what he called the church's undeniable advantages and make Spain a secular state.
There are likely to be further tensions with Pope Benedict XVI. Mr Zapatero has made it clear that he intends to streamline divorce law and even to relax the conditions placed on abortion.