The history of any language is fluid, without sharp divisions that allow convenient classification. However, the languages of mediæval Iberia can be divided thus:
In the days of Rome, Latin mixed with the tongues of the previous inhabitants of the Iberian Peninsula to form various dialects of "vulgar Latin." As the power of Rome waned, Germanic tribes that once lived on the Roman frontier crossed into the Iberian Peninsula and settled there. The Swabians moved into what would become Galicia, and briefly established their own kingdom. Most of the Iberian Peninsula was ruled by the Visigoths, who eventually conquered the Swabians. No written evidence remains of these early dialects: Latin remained the language of government and literature, as opposed to the colloquial Latin spoken by populace.
In the eastern peninsula, the realms of Aragon, Catalonia, and Navarre waxed and waned in size and strength. Aragon spoke a dialect of Castilian; Catalonia and Navarre spoke distinct dialects of Iberian Latin. Their languages melded together as their political paths merged. Aragon united with Catalonia, Valencia, and the Balearic Islands in the Middle Ages and stood as a strong counterweight to Castilian power on the peninsula, but the two great Christian kingdoms were united in the fifteeneth century by the marriage of Ferdinand and Isabella. Navarre played an important part in Iberian politics in the Middle Ages, but was boxed in by Catalonia and Aragon, reduced to insignificance, and finally conquered by Ferdinand of Aragon, who incorporated it into Spain. In 1492, the united Spain finally conquered Granada, the last Moorish kingdom of Iberia. In 1580, it had a go at incorporating Portugal as well, but was forced to release it in 1640.
The Galicians, in emulation of the Asturians, drove southward, pushing the Moors down towards Andalucia. One of their earliest conquests was a town the Romans had called Portus Cale, which the locals called O Porto (the harbour). Eventually, the area around O Porto (later just Porto or Oporto) was considered a region in its own right, and referred to by a sort of softened version of its old Latin name: Portugal.
Portugal was given as sort of a marriage gift to Henry of Burgundy, who brought an army to support the king of Leon against the Moors. His son, Afonso, seized a chance in the twelfth century to declare Portugal's independence. Despite his attempts and his successors' to bring Galicia under Portuguese rule, the Galicians seemed content to be ruled by the Castilians. To this day, Galicia is ruled from Madrid and not Lisbon. The Portuguese joined in the Asturian reconquest, and, by the middle of the thirteenth century, had driven the Moors from their part of the Iberian Peninsula.
Having run out of Moors to fight, the Portuguese fought with theselves and with Castile-Leon through a good part of the fourteenth century. However, Europe's cultural blossoming in the Renaissance was as much a product of Portugal as of Italy. The Portuguese discovered and colonized most of the islands of the Atlantic, the coast of sub-Saharan Africa, and the Indies. Portuguese speakers, in that brillant time, could be found as permanent residents from Morocco to Sri Lanka to Japan in the Old World, and in Brazil in the New World.
They didn't spend all of that time in warfare and exploration. Portuguese became the language of poetry not just in the court of its king, but also in those of the other Christian principalities, from the twelfth through the fourteenth centuries. However, it was never the peoples' language outside of Galicia, Portugal, and Portugal's colonies.
Catalan developed its own literary tradition. It was the language of Ramon Llull, who, as a knight, philospher, and missionary to the Moors, produced such works as the Book of the Order of Chivalry, which was translated all over mediæval Europe and was one of the first books printed in England. In the 15th century, it was the language of "Tirant lo Blanc", one of the last chivalric epics of the mediæval tradition.
As the Catalans thrived, they spread to the south and west, into Valencia, and out into the Mediterranean, expelling the Moors from the Balearic Islands Majorca, Minorca, and Ibiza, and vying with other Christian countries for control over Sardinia, Sicily, and parts of Greece. The Balearic Islands are Catalan-speaking to this day, and Catalan maintains a tiny presence in Sardinia as well.
The Jews and Moors of the Iberian Peninsula, in addition to their ritual languages of Hebrew and Arabic (and, indeed, in the case of Arabic, the official language in the Moorish principalities), also spoke Romance languages. The Jewish language Ladino is mostly Castilian in nature, with bits of Hebrew and Arabic mixed in, much as Yiddish is mostly German, with admixtures of various Eastern European languages and Hebrew. Ladino is still spoken in the communities around the Mediterranean formed from the descendants of the refugees from the late 15th century expulsions from Spain and Portugal. The Moors' language was called Aljamia. It, too, seems to have been most similar to Castilian. However, the conquered Moors, or Mudejars, either left the country and spoke Arabic, or assimilated as best they could into the Christian Iberia of the Renaissance, and their language died.
 Romance languages are derived from Latin, the common tongue of the Roman Empire which ruled most of the Iberian Peninsula from the Punic Wars in the 3rd century BCE to the Germanic invasions of the 5th century CE.
Layout, editting, and publishing Arval Benicoeur.