Pedro Ruiz de Azagra (died 1186) was a Navarrese nobleman and soldier who established the independent Lordship of Albarracín, which lasted until 1284. He was the second son of Rodrigo Pérez de Azagra. His elder brother was Gonzalo Ruiz and his younger brother, later successor, was Fernán Ruiz.
Pedro married Toda (or Tota) Pérez, the daughter of another Navarrese nobleman, Pedro de Arazuri. These two Pedros left Navarre about the same time, probably because they did not accept the succession of Sancho VI in 1154, after the death of his (elected) father, García Ramírez. He ended up in the service of Muhammad ibn Mardanis, ruler of the taifas of Valencia and Murcia. Between 1166 and 1168 (or perhaps as late as 1169–70), Ibn Mardanis entrusted to him the lordship of Albarracín to defend his taifa's northern borders from the expansionist Alfonso II of Aragon. Pedro immediately began Christianising his lordship, refounding churches and erecting a bishopric. His refusal to recognise Aragonese sovereignty extended to his bishop, Martin, who refused to recognise the supremacy of the Bishop of Zaragoza, though ordered to do so by the pope. Pedro also repopulated the region of Albarracín, mostly with settlers from Navarre.
Pedro was generally on friendly terms with Navarre and with Alfonso VIII of Castile. In August 1170, he and his brother Gonzalo were part of an embassy sent by Alfonso VIII to meet his fiancée, Eleanor, in Bordeaux and conduct her back to him. Yet even when his father-in-law aligned with Castile, Pedro remained neutral. In 1172, Cerebrun, the Archbishop of Toledo in Castile and the primate of Spain, consecrated the bishop of Santa María de Albarracín and attached it to his diocese. In 1176, Pedro first called himself a "vassal of Saint Mary", a title to be employed by most of his successors, claiming no suzerain on Earth, only the Virgin Mary in heaven.