The death of King Alfonso II brought about a succession crisis in the Kingdom of Asturias. According to the Chronicle of Alfonso III, credited to Ramiro's grandson, the childless Alfonso II chose as his successor Ramiro, his distant kinsman and son of Alfonso's predecessor Bermudo I. At the time of King Alfonso's death, Ramiro was outside of Asturias in Castile (or Bardulia according to the Chronicle of Alfonso III), where he was attending his own marriage ceremonies.
Nepocian, comes palatii and the late king's son-in-law, challenged Ramiro's succession in his absence, being supported by Astures and Vascones who had been loyal to Alfonso II. Ramiro sought support in Galicia, where he formed an army and advanced toward Oviedo. Nepotian awaited Ramiro's advance at Cornellana, by the river Narcea where either Ramiro defeated him in the Battle of the Bridge of Cornellana or Nepotian's troops fled without putting up a fight. Nepotian fled. He was pursued and captured by Counts Scipion and Sonna. After his capture, Nepotian was blinded and interned in a monastery. Upon gaining the throne, Ramiro removed the system of election through which a faction of nobles had favored the succession of Nepotian.
Early in his reign, Ramiro received word that Viking pirates were attacking along the Atlantic coast of France, and were headed in the direction of the Cantabrian coast of his own kingdom. The Vikings were mainly in search of navigable rivers and large cities to sack. Asturias lacked these; the chronicles of the era refer only to two minor attacks in Gijón and in A Coruña, both in 844. These attacks were confronted by troops sent by Ramiro.
The Viking invaders, having failed to sack Asturias, later successfully attacked and sacked Lisbon and, still later, Cádiz and Seville. They then advanced into the interior of the Iberian peninsula and menaced Córdoba. Abd ar-Rahman II organized a large army to defeat the invaders and recapture Cádiz and Seville.
According to legend, in 834 Ramiro defeated the Moors in the Battle of Clavijo. The date was later changed to 844 in order to accommodate the contradictions inherent to the story (Ramiro was not ruling in 834). The account of the battle came to the spotlight on a spurious charter forged in Santiago de Compostela in the early 12th century. Neither Asturian nor Arab chronicles of the period make any mention of such a battle. It is first mentioned in the chronicles of the Rodrigo Jiménez de Rada, 13th century archbishop of Toledo.
The account of the battle appears to be a mythification of the historical 859 Second Battle of Albelda, in which Ramiro's son and successor Ordoño I along with García Íñiguez of Pamplona crushed the forces of Musa ibn Musa ibn Qasi. According to the legend, during the battle, Saint James the Greater, the Moor-Slayer, is said to have appeared riding a white horse and bearing a white standard, and aided Asturian troops to defeat the Moors. This gave rise to the cult of Saint James in Iberia (see Way of St. James).
In thanks for the intervention of the Apostle, Ramiro is said to have instituted a forged grant called Voto de Santiago actually dating from the 12th century, a tax for the benefit of the Church that was finally repealed by the Cádiz Cortes in 1812.
In reality, Ramiro's most important confrontation with the Muslim kingdoms of Iberia was not such a success. Emir Abd ar-Rahman II of Córdoba likewise had to face Viking invaders, as well as internal rebellions led by Musa ibn Musa, of the Banu Qasi family. Ramiro took advantage of the temporary respite by repopulating the city of León (see Repoblación).
This particular attempt at repopulation was short-lived. Abd ar-Rahman II dispatched both the Vikings and the rebels, and in 846 sent an army led by his son (later Muhammad I of Córdoba), forcing the Christians to evacuate León, which the Muslims burned. The city was not reoccupied until 856, under Ordoño I.
While Asturias under Ramiro was relatively free of foreign confrontations, the latter portion of the reign saw much internal conflict. As mentioned above, his ascent to the throne had been problematic, and he continued to encounter discontented and rebellious nobles. The Chronica Albeldensis makes mention of two of these rebels in particular. After defeating the rebel prócer (grandee or high-ranking noble) Piniolo, Ramiro condemned him to death along with his seven sons. The leader of the second rebellion, the comes palatii Aldroito, he condemned to be blinded.
Ramiro also acted with severity against latrones (thieves) whose number nonetheless grew the civil discord of his reign, and against magos, presumably the pagans still rooted amongst the more isolated settlements.
The Chronica Albeldensis praises Ramiro as Uirga iustitiae, that is, "the Rod of Justice".
All that is known of Ramiro's first marriage is that it must have occurred early enough for his son to have already been an adult at the time of Ramiro's succession. Ramiro's son Ordoño succeeded his father as king of Asturias upon the former's death.
Ramiro contracted his second marriage, to Paterna, around 842, the year of the death of his predecessor Alfonso II. The chronicle of his grandson asserts that when Alfonso II died, Ramiro was in the Castilian lands for his wedding, suggesting that his wife was Castilian. It is presumed that the bride in this marriage was the Paterna who appears later as his widow.
There is no solid evidence of children other than Ordoño. Traditionally, Count Rodrigo of Castile (died 873) has been named as son of Ramiro and Paterna. The medievalist Justo Pérez de Urbel says that Rodrigo was named count of Castile because of his link to the Asturian royal family, and that it is possible that this link existed through Queen Paterna, but not necessarily through being her son.
Ramiro also may have been the father of Gatón, Count of Astorga and of El Bierzo, since the 14th century Al-Bayan al-Mughrib of Ibn Idhari, states that Gatón was the 'brother' of Ordoño I de Asturias.
Ramiro died 1 February 850 [ on the sepulcher is Feb 1, 888] in his palace at Santa María del Naranco, located on Mount Naranco, near the city of Oviedo. He was buried in the Pantheon of Asturian Kings in the Cathedral of San Salvador, Oviedo, alongside his second wife, Paterna. His remains were deposited in a stone sepulcher, no longer extant, next to a similar sepulcher for his predecessor Alfonso II el Casto. His sepulcher was inscribed:
"OBIIT DIVAE MEMORIAE RANIMIRUS REX DIE KAL. FEBRUARII. ERA DCCCLXXXVIII. OBTESTOR VOS OMNES QUI HAEC LECTURI ESTIS. UT PRO REQUIE ILLIUS ORARE NON DESINETIS".
The art and architecture of Ramiro's reign forms the Pre-Romanesque Ramirense phase of Asturian art. His court was the center of great splendor, of which the palace and church of Santa María del Naranco and San Miguel de Lillo are testimony.
On the southern slopes of Mount Naranco, near the city of Oviedo, Ramiro I ordered the construction of the palace of Santa María del Naranco, and a church known as San Miguel de Lillo or Liño. The church collapsed in the thirteenth century, and today only about a third of the original survives. Related service buildings do not survive even as ruins.
Another example of Ramirense architecture is the church of Santa Cristina de Lena, near the municipality of Lena, some 30 kilometres (19 mi) from Oviedo. The palace and the two churches have been designated World Heritage Sites by UNESCO.
Ramirense architecture introduced barrel vaults made of tufa (a relatively lightweight limestone). These were novel not only with respect to earlier architecture of the region but in terms of the European architecture of the period, including that of Muslim Spain, which used wooden roofs.
The historical novel Los clamores de la tierra by the Asturian author Fulgencio Argüelles is set in the era of Ramiro I. It begins with the sentencing of Nepotian to be blinded, and focuses on Ramiro's fight against the surviving pagan cults of the region.