The kingdom was established by a Visigothic nobleman, Pelayo, who rebelled against the Moorish governor of Asturias in 718. Not long afterwards, he inflicted a crushing defeat on the Moors at the Battle of Covadonga, an event which likely took place in the summer of 722, although some sources place it as early as in 718, and others in 721. At some point, Pelayo was elected king of a small realm which included a mountainous area along the northwestern part of Spain, just west of the Basques who also stayed independent of Islam.
Pelayo founded a dynasty in Asturias which survived for centuries and gradually expanded the kingdom's boundaries until all of northwest Iberia was included by roughly 775. The reign of Alfonso II from 791-842 saw further expansion of the kingdom to the south, almost as far as Lisbon, Portugal.
The kingdom was known as Asturias until 924, when it became the Kingdom of Leon. It continued under that name until incorporated into the Kingdom of Castile in 1230, after Ferdinand III became joint king of the two kingdoms.
See also the modern Spanish autonomous community of Asturias.