Eighty-eight percent of people in Spain believe that homosexuality should be socially accepted, the study by the Washington-based think tank Pew Research Group shows.
Other countries to score very highly in the survey of views towards homosexuality in 39 countries were Germany, the Czech Republic, France, Britain and Italy.
In Germany 87 percent said homosexuality ought to be accepted. That number was 77 percent in France and 76 percent in Britain.
In Greece, meanwhile, that figure is 53 percent.
The survey of over 37,000 people found widespread acceptance of homosexuality in North America, the European Union, and much of Latin America, but this was balanced against broad rejection in predominantly Muslim nations and in Africa, as well as in parts of Asia and in Russia.
Pew also found attitudes to homosexuality had been quite stable in recent years, except in the cases of South Korea, the US and Canada, where the percentage of people saying homosexuality should be accepted by society has shot up by at least ten percentage points since 2007.
In the United States, 60 percent of respondents said that homosexuality should be socially acceptable.
Pew Research Group also found differences between age groups in terms of levels of homosexuality. In the US, for example, 70 percent of people aged 18–29 say homosexuality should be acceptable, while that number was just 52 percent among the over-50 age group.
In Spain, that number is relatively equal. Some 90 percent of the younger group want social acceptance for gay people and 85 percent of the older group want this.
Spain legalized gay marriage in 2005 and over 20,000 such unions have taken place in the country since then.
In 2012, Spain's Constitutional Court turned down a challenge to Spain's gay marriage laws.
‘I won’t change the law and I will leave it exactly how it is, ’Spain’s justice minister Alberto Ruiz-Gallardón said at the time.
However, recent research carried out by the Autonomous University of Madrid into the experiences of same-sex couples and their children showed that there are still pockets of concern.
Those researchers found that 40.9% of families composed of a male or female single-sex partnership and at least one child under the age of 18 has been completely rejected by a close family member, such as an aunt or grandparent.
A further 32.4% feel "very or quite" discriminated against by relatives.
Meanwhile, most children of same-sex partnerships reported that they did not feel discriminated against at school but 20.1% reported that they had been insulted or ostracized because of their family model.
Insults included "your dad's a faggot and you're a faggot too".
Of the children of the 71 families who took part in the study, three reported having suffered physical attacks at school.