The Conquest of Tunis in 1574 marked the final conquest of Tunis by the Ottoman Empire over the Spanish Empire. This was an event of great significance as it decided that North Africa would be under Muslim rather than Christian rule and ended the Spanish Conquista of Northern Africa started under Isabella I of Castile and Ferdinand II of Aragon. The capture of Tunis in 1574 "sealed the Ottoman domination of the eastern and central Maghreb".
Tunis had initially been conquered by the Ottomans under Hayreddin Barbarossa in 1534. In the next year, however, Holy Roman Emperor Charles V had launched a major expedition and captured it in turn. He established a garrison and a vassal ruler in the person of the Hafsid ruler Lhacène. The Bey of Algiers Uluj Ali Pasha captured Tunis in 1569 for the Ottoman Empire, but in the aftermath of the 1571 Christian victory at the Battle of Lepanto, John of Austria managed to take Tunis in October 1573.
In 1574, William of Orange and Charles IX of France, through his pro-Huguenot ambassador François de Noailles, Bishop of Dax, tried to obtain the support of the Ottoman ruler Selim II in order to open a new front against the Spanish king Philip II. Selim II sent his support through a messenger, who endeavoured to put the Dutch in contact with the rebellious Moriscos of Spain and the pirates of Algiers. Selim also sent a great fleet to attack Tunis in the Autumn of 1574, thus succeeding in reducing Spanish pressure on the Dutch.
In the Battle of La Goleta, Selim II mustered a fleet of between 250 and 300 warships, with about 75,000 men. The Ottoman fleet was commanded by Sinan Pacha and Alūj Ali. The Ottoman fleet combined with troops sent by the governors of Algiers, Tripoli and Tunis, giving a combined strength of about 100,000. The army attacked Tunis and La Goleta; the presidio of La Goleta, defended by 7,000 men, fell on 24 August 1574. The last Christian troops in a small fort opposite Tunis surrendered on 3 September 1574.
John of Austria attempted to relieve the siege with a fleet of galleys from Naples and Sicily but failed due to storms. The Spanish crown, being heavily involved in the Netherlands and short of funds was unable to help significantly.
Cervantes participated in these events as a soldier, and was among the troops of Don Juan of Austria which tried to rescue the city. He claims that the Ottomans led 22 assaults against the fort of Tunis, losing 25,000 men, while only 300 Christians survived. He wrote about the battle:
"If Goleta and the fort, put together, held barely 7,000 soldiers, how could such a small force, however resolute, come out and hold its own against so huge an enemy army. And how can you help losing a stronghold that is not relieved, and especially when it is surrounded by a stubborn and very numerous army, and on its own ground?"
Gabrio Serbelloni was the commander of the fort of Tunis. The general of La Goleta, Don Pedro Portocarerro was taken as a captive to Constantinople, but died on his way. The captured soldiers were employed as slaves on galleys.
The success of the Turks under Occhiali in the battle of Goleta managed in reducing Spanish pressure on the Dutch, and leading to negotiations at the Conference of Breda. After the death of Charles IX in May 1574 however, contacts weakened, although the Ottomans are said to have supported the 1575–1576 revolt, and establish, in 1582, a Consulate in Antwerp (De Turks-Griekse Natie). The Ottomans made a truce with Spain, and shifted their attention to their conflict with Persia in the Ottoman–Safavid War (1578–1590). The Spanish crown fell into bankruptcy on 1 September 1575.