The first care of King Alfonso was to raise a sanctuary on the spot where the tomb had just been miraculously discovered. Built in haste, and at a time when, owing to the unsettled state of the kingdom, the royal resources were very limited, the edifice was of a very humble character as regarded both size and materials: “Petra et luto opus parvum” is the description given of it in the Act of Erection of the second church, built later by Alfonso III. The king was nevertheless able to endow it with a certain revenue, and to secure a permanent provision to its ministers. The archives of Compostella long preserved a privilege granted by Alfonso the Chaste, in virtue of which all the lands with their villages, for three miles round, were made over to the church.

Spain was speedily made aware of the discovery; the neighboring nations, and in particular the Gauls, heard of it also, and the faithful from both countries flocked in great numbers to the tomb, drawn by the fame of the miracles which immediately began to be wrought there, and of which Valafrid Strabo, who died in the year 849, makes mention: Plurima hic præsul patravit signa stupenda.

The relations of Gaul with Christian Spain were at that time very frequent. The infidels were the common enemy. Charles Martel had driven them from Gaul, but the struggle that still went on south of the Gallic frontiers had an intense interest for all Christendom. Charlemagne was allied in friendship with Alfonso the Chaste, though it is doubtful whether he ever made the pilgrimage of Compostella, as some have said. It is, however, certain that he joined his entreaties to those of the king of Leon to obtain from Pope Leo III. the transfer of the bishopric of Iria to Compostella. This was the name already borne by the town which had rapidly risen round the apostle’s tomb, and which was given in remembrance of the starlike lights which had revealed its locality—Campus Stellæ.

The pope granted the request of the two monarchs. Compostella replaced the bishopric of Iria and remained suffragan to the archbishop of Braga until the town of St. James should be raised to the metropolitan dignity. King Alfonso, who had no children, offered to bequeath his throne to Charlemagne, on condition that that monarch would drive the Moors out of Spain. Charlemagne accepted the terms and crossed the Pyrenees; but the Spanish princes, disapproving of Alfonso’s proposal, leagued together against the emperor, and some of them, later on, allied themselves with the Moorish king of Saragossa, and destroyed at Roncesvaux the rearguard of Charlemagne’s army, in which perished Roland, the hero par excellence of the lays and chronicles of the time.

Some time afterwards, when Ramira had succeeded Alfonso the Chaste, and Abderahman II. was King of Cordova, the latter, inflated by his successes, sent to demand of the Spanish king an annual tribute of a hundred young maidens. Ramira indignantly drove away the ambassadors, assembled his troops, and declared war. He was defeated in the battle of Alaveda, and forced to withdraw with the remnant of his army to a neighboring elevation, where the Moor could not fail to attack him. The Christian monarchy in Spain seemed on the very brink of ruin. That night the king had a dream, in which the apostle St. James appeared to him, grand and majestic, bidding him be of good courage, for that on the morrow he should be victorious. The king related his vision to the prelates and leaders of his army, and made it known to the soldiers also. Immediately every heart kindled with fresh enthusiasm; the little band threw itself upon the infidel host, while on all sides arose the shout, Sant’ Iago! Sant’ Iago! which has ever since been the war-cry of Spain.

The Moors were thrown into confusion and completely routed, leaving 60,000 of their number on the field of battle. It was averred that during the whole engagement the apostle St. James, mounted on a white charger, and bearing in his hand a white banner with a red cross, was seen at the head of the Christian battalions, scattering terror and death among the ranks of the enemy. Thus was fought, in 846, the famous battle of Clavijo, all the glory of which is due to the patron of Spain.

After a solemn act of thanksgiving to God the army made a public vow, obligatory on all the kingdom, to pay yearly to the church at Compostella one measure of corn and one of wine from every acre of land. Immense riches were found in the Moorish camp, and these were consecrated to the erection of two magnificent churches—one at Oviedo, in honor of the Blessed Virgin, and another under the invocation of St. Michael.

From this time the devotion to the apostle who had shown himself the protector and deliverer of the country spread far and wide. Pilgrims thronged from every quarter to his tomb, which became the great pilgrimage of the west, the pendant to Jerusalem, with Rome between the two.

The humble church erected by Alfonso the Chaste was by no means suitable to the dignity of the deliverer of Spain, nor sufficient for the ever-increasing number of pilgrims. In the year 868 Alfonso III., together with Sisenand, then Bishop of Compostella, undertook to replace it by a cathedral. “We, Alfonso,” it is written in the Act of Erection, “have resolved, together with the bishop aforesaid, to build the house of the Lord and to restore the temple and tomb of the apostle which aforetime had been raised to his august memory by the Lord Alfonso, and which was only a small construction of stone and clay. Urged by the inspiration of God, we are come with our subjects, our family, into this holy place. Traversing Spain through the battalions of the Moors, we have brought from the city of Ebeca blocks of marble which we have selected, and which our forefathers had carried thither by sea, and with which they built superb habitations, which the enemy has destroyed.”

All the materials for the new building were thus gathered together, the slabs and columns of marble being of great beauty, but we have little information as to its architectural style or merit. The arts were at that time in a state of temporary decay. The edifices of the Roman period had for the most part perished in the invasions of the Goths, the Suevi, and the Alani. These nations, after having embraced the faith, were speedily civilized, and under its inspiration had raised numerous religious buildings which were not without a certain grandeur, when the Moorish conquest of Spain brought again an almost universal ruin over the land. The influence of the climate, the beauty of the Andalusian skies, softened the fierce character of the victors, and their minds speedily received a wonderful intellectual development. Never did any people make so much progress in so short a time, in art, in science, in culture of ideas, and also in a certain elevation of sentiment. Architecture of great magnificence and originality made rapid advances among them, of which the richness always bore the stamp of a peculiar tastefulness and delicacy.