Spain came in at ninth place in the latest annual Spartacus Gay Travel Index, just above Uruguay and a notch below Norway.
The annual Spartacus Gay Travel Index ranks 140 countries worldwide on how gay and lesbian-friendly they are.
"The new Gay Travel Index looks at the latest laws on homosexuality including, for example, the positions of gay marriage and adoption, or limitations for people infected with HIV," said Spartacus editor Brian Bedford.
"Other factors like religious influence and the banning of pride marches, as well as the existence of marketing activities for gay and lesbian travellers, were also taken into account," said Bedford.
The travel guide company scored Spain well because of its anti-discrimination legislation and its marriage and partnership rules. The country also racked up points because homosexual couples can adopt children here.
Spartacus marked Spain down, however, because of possible hostility of locals and the influence of the church in this country.
Sweden came in top in the Spartacus list and was the only country to gain top marks for its anti-discrimination legislation. Also near the top were a group including Belgium, France, the Netherlands and the United Kingdom.
At the foot of the table for gay travellers was Iran. Homosexuality is subject to the death penalty in Iran and murders of gay people occur.
The "extremely high influence of religion also made Iran a particularly unwelcoming place for gay travellers said Spartacus.
Other particularly unfriendly destinations include the United Arab Emirates, Jamaica, Nigeria and Russia.
Spain introduced laws permitting gay marriage in 2005 under the socialist government of José Luis Rodgriguez Zapatero.