The Battle of Torrevicente was fought on Saturday, 9 July 981 between a force loyal to the Caliphate of Córdoba under the command of Ibn Abi ‘Amir and a rebel force under Galib ibn Abd al-Rahman and his Christian allies, King Ramiro Garcés of Viguera and Count García Fernández of Castile. It was Galib's intention to continue the policy of previous caliphs, Abd ar-Rahman III and al-Hakam II, which was to maintain supremacy over the Christian principalities in peace. Ibn Abi ‘Amir was pursuing a new policy of jihad, signalled by his seven aggressive actions against the Christians in the previous three years. Both Ramiro and Galib died during the battle and Ibn Abi ‘Amir was victorious. It was the twelfth of Ibn Abi ‘Amir's military campaigns, and was called in Muslim sources the "Campaign of the Victory" (Campaña de la Victoria).
The principal sources for the battle—all Arabic—are Ibn al-Khatib (A‘mal al-a‘lam), Ibn Hazm (Naqt al-‘arus), and al-Udri (Tarsi‘ al-ajbar), while Ibn Idari (Boyan), al-Maqqari (Nafh al-tib), and Ibn Alabar (in the biography of Asma, daughter of Galib and wife of Ibn Abi ‘Amir, in his Tekmila) give brief notices. Ibn Hazm relied for his account on his father, Ahmad ibn Hazm, a vizier who took part in the battle on the side of Ibn Abi ‘Amir, while Ibn al-Khatib appears to have relied on Ibn Hazm. No Christian or Latin source mentions the battle, but the Anales castellanos segundos states that "the Moors took Atienza" (prendiderunt mauri Atenza) in the year 1018 of the Spanish era (era mile XVIII), which correspondsd to 980. Atienza was conquered, not from the Christians, but from Galib's partisans as a result of their defeat at Torrevicente. The year, however, was 981.