Pegalajar is a municipality in the province of Jaén, in the Andalusia region of southern Spain. It is located in the comarca (district) of Sierra Mágina, within the foothills of the Sierra Mágina mountain range.
According to the 2005 census conducted by Spain's Instituto Nacional de Estadística (INE), Pegalajar had a population of 3,136 inhabitants. The town lies roughly 20 kilometres south of the provincial capital, Jaén.
Pegalajar is known for its traditional pottery, particularly the production of large earthenware water jugs called cántaros, a craft that has been practised in the area for centuries. The town's historic centre retains narrow, steep streets typical of Andalusian hill towns, and the ruins of a Moorish castle stand on a hill overlooking the settlement.