Moorish Hispania
The North African Muslim, referred to as Moorish, conquest of Hispania (اسبانيا, Arabic: Isbānīya), which they called Al-Andalus (الأندلس), gave a new development, both in form and meaning, to the term "Hispania". The different chronicles and documents of the high Middle Ages designate as Spania, España or Espanha only the Muslim-dominated territory. King Alfonso I of Aragon (1104–1134) says in his documents that "he reigns over Pamplona, Aragon, Sobrarbe y Ribagorza", and that when in 1126 he made an expedition to Málaga he "went to the lands of España".
But by the last years of the 12th century the whole Iberian Peninsula, whether Muslim or Christian, became known as "Spain" (España, Espanya or Espanha) and the denomination "the Five Kingdoms of Spain" became used to refer to the Muslim Kingdom of Granada, and the Christian Kingdom of Castile and León, Kingdom of Navarre, Kingdom of Portugal and Crown of Aragon.
The process of the Reconquista (Christian Reconquest of Hispania from the Moors), produced the emergence of several Christian kingdoms, as the ones mentioned above. Some of these eventually merged into a single country. In fact, with the union of Castile and Aragon in 1479 (and especially with the incorporation of Navarre in 1512), the word "Spain" (España in Spanish, Espanha in Portuguese), began being used only to refer to the new kingdom and not to the whole of the Iberian peninsula, now composed of two independent countries, Portugal and Spain.
Read more about this topic: Hispania