Moroccans in Spain form 12.7% of the 6,058,291 foreigners in Spain. They were formerly the largest foreign group in Spain, but were surpassed by Romanians in 2007. In 2003, they were estimated to make up about 6% of all Moroccans abroad.
Before 1985, Moroccans did not require visas to enter Spain. Many young came for seasonal or short-term work in agriculture and industry, coming and going from Spain without settling there. A new visa law implemented that year, La Ley de Extranjeria, was quite restrictive, and did not provide for permanent residence permits. As late as 1992, official statistics showed only 16,665 Moroccans residing in Spain (of whom 14,998 lived in peninsular Spain). In the following years, many Moroccans came to take jobs in the agricultural, hospitality, construction, and service sectors. By 2000, their population had increased to 201,182 individuals. Along with the growing numbers of migrants, their composition also shifted, with a higher proportion of women among them.
2000 also marked a significant shift in Spanish immigration laws; Law 4/2000 passed that year created mechanisms for family reunification, regularisation of illegal migrants, and acquisition of permanent residency. By 2008, official statistics showed 752,695 legal Moroccan residents of Spain. Beginning in September that year, Spanish authorities began offering payments to unemployed immigrants if they agreed to cancel their residency and leave the country. With official statistics showing 82,262 unemployed Moroccans in Spain, there were expected to be many who would take advantage of the payments. However, according to provisional figures, the Moroccan population of Spain continued to grow during the year, and had reached 858,00 by the beginning of 2011, 8.8% higher than the 2008 total.
Khaldi, Mohammed (July 2003), "Les Marocains résidant en Espagne: caractéristiques démographiques et sociales", in Kabbaj, Khadija, Marocains de l’Extérieur(PDF), Rabat: Fondation Hassan II pour les Marocains Résidant à l’Etranger, pp. 141–206, ISBN9954-400-19-2, retrieved 2009-03-24
Izquierdo Escribano, Antonio (July 2003), "L’immigration en Espagne", in Kabbaj, Khadija, Marocains de l’Extérieur(PDF), Rabat: Fondation Hassan II pour les Marocains Résidant à l’Etranger, pp. 122–140, ISBN9954-400-19-2, retrieved 2009-03-24