Alfonso X (Alfonso the Wise or Alfonso the Learned), son of Ferdinand III and Beatrice, was born in 1221, in Burgos. He was King of Castile and Leon from 1252 to 1284.

Beatrice, was the granddaughter of the Holy Roman Emperor Frederick I. Beginning 1256, Alfonso began pursuing the title of Holy Roman Emperor. In 1257, bribes won him four electoral votes for Emperor to three for Richard of Cornwall, his rival. However Richard, unlike Alfonso, could go to Germany and petition in person for the title and so he failed to be proclaimed Holy Roman Emperor. In 1275, when Richard died, and Alfonso went to France to appeal to Pope Gregory X, who persuaded him to renounce his claim.

Alfonso was known as a scholar before becoming King in 1252. He had many scholars in his travelling court, and he was an active participant in their writing and editing. Some were experts on Roman law, which he hoped to make the basis of a uniform code for his lands. He did not live to see this happen, but eventually the laws of Castile and Leon reflected the Roman code of laws.

Alfonso was also responsible for the creation of what is known as the Alfonsine tables, an astronomical tabulating device to keep track of the movement and position of the planets. He ordered their creation to correct the errors in the Ptolemaic tables and it is from the Alfonsine tables we get our year divided into 365 days.

Alfonso crushed a Muslim revolt in 1252, and a revolt by nobles in 1254. Morocco, Granada, and Murcia invaded his kingdom in 1264, but Alfonso won with Aragonese help, and annexed Murcia. In 1272, a revolt by nobles forced him to confirm local privileges.

In 1273 Alfonso founded, and granted privileges to, the Mesta, a guild of migratory shepherds.

While Alfonso was in France meeting with the Pope, Morocco and Granada joined forces and invaded Castile. Ferdinand, Alfonso's eldest son, was killed in the fighting. Sancho, Alfonso's second son, became a hero in defeating the invaders, and proclaimed himself heir. This displaced Ferdinand's sons, who were nephews of the French king, Louis (St. Louis), and should have been proclaimed Alfonso's heirs. Alfonso recognized Sancho's claim in 1278, but, under French pressure, became ambiguous in 1281. Taking advantage of grievances against Alfonso, Sancho declared himself regent. Towns and nobles rose against Alfonso, who had to take refuge in Seville. Some of Sancho's followers deserted, but, after Alfonso died in 1284, Sancho took Seville and became King Sancho IV.