In another sign of the changing times, a gay LGBT police association will march on Saturday in the massive WorldPride parade.
"I thought only a handful of people would turn out but it was packed," recalls Josep Maria Radua, 73, who took part in Spain's first ever gay pride march held in central Barcelona on June 26 of that year.
Pictures show transsexuals at the head of the march along with men with thick moustaches and sleeveless shirts, women showing their buttocks. They held up signs condemning the persecution of homosexuals.
"I cried," said 66-year-old Joan Andreu Bajet. "Not only did we emerge from a long silence but we also showed our faces. We said: 'I'm gay, I'm gay', not just to our colleagues, but to the whole world."
Police hit the protesters with their batons and fired rubber bullets to break up the march.
But the event launched the fight against discrimination that would eventually turn staunchly Roman Catholic Spain into a world leader on gay rights.
At the time the country was experiencing an explosion in freedoms following the death in 1975 of longtime dictator Francisco Franco, whose conservative regime considered homosexuals a threat to their ideal of a "macho" Spanish male.
Spain had just held its first democratic elections since the end of the dictatorship when the country's gay and lesbian movement decided to stage this first rally.
Maria Giralt, who was just 18 at the time, discovered at the march that there were many more people like her.
"I had known since I was 14 that I liked women, but I did not even know the word 'lesbian'. The topic was taboo, you lived it in solitude," she said.
The Franco regime punished homosexuality with prison terms of three to six months.
Between 3,000 to 5,000 people were jailed for their "rehabilitation".
"It was not a mass hunt but something rather selective, as a warning," said Arturo Arnalte, the author of a book on the repression of gays during the Franco era.
"We were considered sick, lecherous, abnormal," he added.
The worst part was "the social stigma, losing your job, being ridiculed, subject to family pressure, abandoned by friends," Arnalte said.
"Being gay was your social death," said Joan Andreu Bajet of the Catalan Gay Liberation Front which organised the 1977 march in Barcelona on La Rambla boulevard, which was home to several gay gathering places.
The following year Madrid held its first gay pride march.
In 1979 the Law of Social Danger and Rehabilitation which was used to jail gays was repealed.
Spain in 1987 recognised transsexuality by allowing people to change their gender on official documents event if they have not undergone surgery.
That same year Oscar-winning Spanish director Pedro Almodovar released "Law of Desire" which depicted a gay love triangle between three men that included a transsexual character and a scene depicting sodomy.
Spain made headlines around the world in 2005 when Socialist Prime Minister Jose Luis Rodriguez Zapatero legalised same-sex marriage and gay adoption despite heavy opposition from the Roman Catholic church.
The law made Spain only the third country in the world to legalise same-sex marriage, after the Netherlands and Belgium, and the first predominantly Roman Catholic one to do so.
"It was a revolution," said Evelyne Paradis, director for Europe of the International Lesbian, Gay, Trans and Intersex Association.
"The example set by Spain, where the influence of religion was very strong... had a huge impact," she added.
Today 90 percent of Spaniards back equal rights for gays and lesbians, according to a study by the European Commission. Only Sweden and the Netherlands posted higher approval levels.
But about a third of gays and lesbians, 30 percent, have suffered discrimination at work, according to Spain's National Federation of Lesbians, Gays, Transsexuals and Bisexuals (FELGTB).
Spanish authorities have also recorded a jump in hate crimes targeting gays in recent years.
"We have changed so much," said Radua. "Forty years ago police mistreated us. And just a month ago they placed a plaque in honour of our foundation" for elderly LGBT people, he added.
In another sign of the changing times, a gay LGBT police association will march on Saturday in the massive WorldPride parade in Madrid.