The ancient 14th century shrine was built in the municipality of Azuaga and Enrique Infante de Aragón, Grand Master of the Order of Santiago, ceded part of the municipality of Azuaga to Guadalcanal on 10 April 1428. There were arguments and disputes between the two towns, so the Grand Master appointed judges, who gave a ruling on 20 November 1469 in favour of Guadalcanal, which was later confirmed by the Catholic Monarchs in 1494.
Alonso Carrasco de Ortega, descendant of the conquerors of Extremadura, and his wife Beatriz de la Rica, ordered the construction of a new shrine. The works began in 1638 and were completed in 1647. The annual pilgrimage was not established until 24 May 1792. Before, the Virgin was only taken into the town in exceptional cases of misfortune.
Construction of the alcove began in 1718 and was completed in May 1719. The Niño Bellotero dates from 1300.
On 4 September 1722, by Royal Decree, Felipe V granted the Trusteeship and Administration of the Guaditoca Shrine to the Marquis of San Antonio y Mira del Río, Alonso de Ortega y Toledo.