Castillo de San Pedro is an 18th-century coastal fortress located in Níjar within the Cabo de Gata-Níjar Natural Park, built on the remains of an earlier Muslim tower. Constructed between the 16th and 18th centuries, it features a rectangular plan with a truncated cone tower and semicircular artillery battery, reflecting its strategic importance as the second most significant fortification in the Cabo de Gata defensive system. The castle was designed to protect a natural anchorage near a freshwater spring against pirate raids and served a crucial role in the Kingdom of Granada's maritime defenses.