During the Second Punic War, roughly between 210 and 205 BCE the expanding Roman Republic captured Carthaginian trading colonies along the Mediterranean coast. Although it took the Romans nearly two centuries to complete the conquest of the Iberian Peninsula, they retained control of it for over six centuries. Roman rule was bound together by law, language, and the Roman road.
The cultures of the pre-Roman populations were gradually Romanised (Latinised) at different rates depending on what part of the peninsula they lived in, with local leaders being admitted into the Roman aristocratic class. Hispania served as a granary for the Roman market, and its harbours exported gold, wool, olive oil, and wine. Agricultural production increased with the introduction of irrigation projects, some of which remain in use. Emperors Hadrian, Trajan, Theodosius I, and the philosopher Seneca were born in Hispania. Christianity was introduced into Hispania in the 1st century CE and it became popular in the cities in the 2nd century CE. Most of Spain’s present languages and religion, and the basis of its laws, originate from this period. In the late 2nd century (starting in 170 CE) incursions of North-African Mauri in the province of Baetica took place.
The Germanic Suebi and Vandals, together with the Sarmatian Alans entered the peninsula after 409, henceforth weakening the Western Roman Empire’s jurisdiction over Hispania. These tribes had crossed the Rhine in early 407 and ravaged Gaul. The Suebi established a kingdom in north-western Iberia whereas the Vandals established themselves in the south of the peninsula by 420 before crossing over to North Africa in 429. As the western empire disintegrated, the social and economic base became greatly simplified: but even in modified form, the successor regimes maintained many of the institutions and laws of the late empire, including Christianity and assimilation to the evolving Roman culture.
The Byzantines established an occidental province, Spania, in the south, with the intention of reviving Roman rule throughout Iberia. Eventually, however, Hispania was reunited under Visigothic rule. These Visigoths, or Western Goths, after sacking Rome under the leadership of Alaric (410 CE), turned towards the Iberian Peninsula, with Athaulf for their leader, and occupied the northeastern portion. Wallia extended his rule over most of the peninsula, keeping the Suebians shut up in Galicia. Theodoric I took part, with the Romans and Franks, in the Battle of the Catalaunian Plains, where Attila was routed. Euric (466 CE), who put an end to the last remnants of Roman power in the peninsula, may be considered the first monarch of Spain, though the Suebians still maintained their independence in Galicia. Euric was also the first king to give written laws to the Visigoths. In the following reigns the Catholic kings of France assumed the role of protectors of the Hispano-Roman Catholics against the Arianism of the Visigoths, and in the wars which ensued Alaric II and Amalaric died.
Athanagild, having risen against King Agila, called in the Byzantines and, in payment for the succour they gave him, ceded to them the maritime places of the southeast (554 CE). Liuvigild restored the political unity of the peninsula, subduing the Suebians, but the religious divisions of the country, reaching even the royal family, brought on a civil war. St. Hermengild, the king’s son, putting himself at the head of the Catholics, was defeated and taken prisoner, and suffered martyrdom for rejecting communion with the Arians. Recared, son of Liuvigild and brother of St. Hermengild, added religious unity to the political unity achieved by his father, accepting the Catholic faith in the Third Council of Toledo (589 CE). The religious unity established by this council was the basis of that fusion of Goths with Hispano-Romans which produced the Spanish nation. Sisebut and Suintila completed the expulsion of the Byzantines from Spain.
Intermarriage between Visigoths and Hispano-Romans was prohibited, though in practice it could not be entirely prevented and was eventually legalised by Liuvigild. The Spanish-Gothic scholars such as Braulio of Zaragoza and Isidore of Seville played an important role in keeping the classical Greek and Roman culture. Isidore was one of the most influential clerics and philosophers in the Middle Ages in Europe, and his theories were also vital to the conversion of the Visigothic Kingdom from an Arian domain to a Catholic one in the Councils of Toledo. Isidore created the first western encyclopedia which had a huge impact during the Middle Ages.