By Katya Adler
BBC correspondent in Madrid
The Spanish cabinet approved a bill on Friday allowing same-sex marriages.
Gay couples should have equal rights, Spain's government says
If eventually endorsed by parliament - and Prime Minister Jose Luis Rodriguez Zapatero has promised it will be by early next year - Spain will become the third European country, after Belgium and the Netherlands, to pass such a far-reaching reform.
It is not simply a matter of legalising same-sex marriages, but of putting homosexual and heterosexual couples on an equal legal footing. This includes tax breaks, the right to a widower's pension, inheritance, divorce and alimony.
Most controversially, it also includes the right for gay couples to adopt children.
But the Spanish government brushes aside any suggestion that it is engineering a social revolution.
"Legalising gay marriages is simply logical," says First Deputy Prime Minister Maria Teresa Fernandez de la Vega.
"Around four million Spaniards are gay. That's about 10% of our population. Why shouldn't they have exactly the same rights as every other taxpayer?"
Granting the gay community the legal right to marry is not some whim this socialist administration dreamt up over its first summer in government.
"The Spanish Socialist Party stands for, and has always stood for, civil rights," insists Pedro Zerolo, a Socialist Party Deputy and the President of Spain's National Gay and Lesbian Federation.
GAY MARRIAGE IN EUROPE
Netherlands: Gay marriages allowed since 2001
Belgium: Gay marriages allowed since 2003
Sweden: Civil unions giving gay people the same rights as married couples, since 1994
"During our last eight years in opposition, we always said to Spaniards - Vote for us and vote for an inclusive government, for all Spaniards, with special attention to minorities.
"Gay marriage is just one small part of a whole range of social reforms that we're planning."
Indeed in the few months since they came to power, the Socialists have discussed: increasing state pensions and providing more housing for low-income families, but also liberalising Spain's abortion laws, the laws concerning embryo research, organising a national debate on euthanasia, introducing a fast-track divorce system and removing compulsory religious education from state schools.
For the Socialists and their supporters, this is all about recognising individual human rights and freedoms.
But their critics see it as a subversive social experiment and a vicious attack by a party with a long history of anti-clericalism.
And the Catholic Church is furious.
It has accused the Socialist government of pursuing an "aggressively secular" agenda and of threatening the institutions of marriage and family in Spain.
Devil in the details
Earlier this week, the spokesman for the Catholic Bishops Conference, Juan Antonio Martinez Camino, likened legalising gay marriage to releasing a virus into Spanish society.
He said it was false, unnatural and an insult to heterosexual couples.
Zapatero wants profound social liberalisation
Yet the majority of Spaniards disagree. Even though most consider themselves to be Catholic and heterosexual.
Recent opinion polls show that around 65% of Spaniards are in favour of gay marriages.
"It's quite simple," says Jesus Bastante, the lead Religious Affairs writer at ABC newspaper.
"Spaniards regard Catholicism as part of their national heritage. Most Spanish children are baptised, but later in life they favour traditions over the religion itself. In the end, we Spaniards are far more liberal-minded than our Church."
But not that liberal-minded, according to Ursula Moreno, of El Mundo newspaper.
"Yes, Spaniards think same-sex couples should have the right to live and love and marry, but what the opinion polls don't show is that Spaniards worry about the details of the new proposed law.
"I think there'll be a huge national debate about whether or not gays and lesbians should be able to adopt children. I don't think Spain is ready," she says.
All that will become clear from the public and media reaction here as the gay marriage bill arrives in the Spanish parliament for debate.
In the past, Spaniards have shown their capacity and appetite for swift and dramatic social change.
During the 1980s Madrid suddenly became intoxicated by a cultural revolution after 40 years of military dictatorship in Spain.
Under the dictator Francisco Franco, homosexuality was illegal and a woman was regarded as the legal property of her husband.
Much has changed here since then. And if the Socialist government gets its way, there are a lot more changes to come.
Spain is fast becoming the Sweden of the Mediterranean.