With more than 5.6 million foreign nationals, Spain is second only to Germany among European Union nations in numbers of immigrants, according to figures compiled by the European Union's statistics office, Eurostat.

The data, from 2010, reveal that there were 5.66 million foreigners, or 12.3 percent of the total population, living in Spain, while Germany's 7.1 million foreign nationals made up 8.7 percent of that country's population.

Following Spain was the United Kingdom, with 4.4 million immigrants, or 7 percent of the population; Italy with 4.2 million, also 7 percent of the population; and France with 3.8 million, representing 6 percent of the total residents.

Of the 5.6 million foreigners in Spain in 2010, 2.3 million came from other EU countries and 3.3 million were from outside the 27-member bloc, according to Eurostat.

In percentage terms, Luxembourg is the EU country with the greatest presence of foreigners, 43 percent, followed by Latvia, with 17 percent, and Estonia and Cyprus, both with 16 percent.