Lopera is a municipality and town in the province of Jaén, in the autonomous community of Andalusia, southern Spain. It lies within the comarca (district) of Campiña de Jaén, a predominantly agricultural area of the Guadalquivir valley known for olive cultivation.
According to the 2014 census, Lopera had a population of 3,837 inhabitants. The town is situated in the north of the province, near the border with the province of Córdoba.
Lopera is best known for the Battle of Lopera, fought in December 1936 during the Spanish Civil War, in which Nationalist forces defeated Republican troops. The town retains a historic core that includes the Church of the Immaculate Conception and the ruins of a Moorish castle.