At sea , the Ottoman Navy contended with several Holy Leagues ( composed primarily of Habsburg Spain , the Republic of Genoa , the Republic of Venice , the Knights of St. John , the Papal States , the Grand Duchy of Tuscany and the Duchy of Savoy ) for control of the Mediterranean Sea .