The Battle of Lepanto in 1571, like the Battle of Tours and Poitiers in 732 A.D., and like the defenses of Vienna in 1529 and in 1683, was an example of Europe successfully deflecting an Islamic invasion. Lepanto, unlike the other examples, was a navy battle. Muslims were expanding from Turkey, marauding along the Mediterranean coastlines. Malta and Sicily were in play, and Greece was the target at the moment.
Philip II of Spain had developed a powerful navy, which was charged with protecting the cargo vessels running import and export between Spain and the Americas. This navy would join others at Lepanto. All the nations with Mediterranean coastlines were exposed to the dangers of raids or invasions: Spain, France, and Italy.
Greece had long been a target for Islamic armies. It represented a strategic position in terms of Mediterranean sea routes, and would be a foothold in Europe. Historian Dorothy Mills writes:
All through the sixteenth century the Turks had been gradually increasing their power in the Mediterranean. In 1571, in response to an appeal made the preceding year by the Pope, Pius V, Philip joined the Papacy and Venice in an alliance against Turkey. The result was the battle of Lepanto. The Spanish and Venetian fleets were under the command of Don John of Austria, the half-brother of Philip. The Turkish fleet, never yet defeated and larger than that commanded by Don John, was beaten with heavy losses and the Italian shores of the Mediterranean were saved from further Turkish attacks.
The Spanish navy's heroic defense of Europe against the attacking Islamic fleet brought glory. That glory would fade in 1588, when the Spain and England squandered the security which the Battle of Lepanto bought for them.