Koprulu Mehmed Pasha only ruled for five years before he died, but in that time he rescued the Ottoman navy from the Venetians, and he won battles in the Balkans against Hungary that made the Ottoman Empire bigger. When he died in 1661, his son, Fazil Ahmed Pasha, succeeded him as the real ruler of the Ottoman Empire. Like his father, Fazil Ahmed Pasha fought in the Balkans against Austria, and he also fought in the Ukraine against Poland, and again expanded the Ottoman Empire. Fazil Ahmed Pasha also finally won Crete back from Venice. He also improved the tax system and encouraged trade.
The next Grand Vizier, in 1676, was Fazil Ahmed Pasha’s brother-in-law, Kara Mustafa Pasha. Kara Mustafa Pasha was less successful than the first two Viziers. He lost most of Ukraine to Peter the Great, the czar of Russia in 1681. Moving west instead of north, Kara Mustafa Pasha besieged Vienna (Austria) in 1683, but here again he lost the battle. As a result he was killed, beginning a period of several years where the Ottomans had no good rulers and kept losing land and getting poorer.
After the Austrians beat the Ottomans in another big battle in 1697, the Ottomans lost control of the Balkans to Austria-Hungary. Amcazade Koprulu Huseyin Pasha became the new Grand Vizier, who immediately had to sign away southern Greece to Venice. Amcazade Huseyin tried to modernize the Ottoman Empire. He minted better quality money, reduced taxes to what people could pay, and encouraged craftsmen to make things instead of buying them from Europe. But by 1702, Amcazade Huseyin lost most of his power to an Islamic imam, Feyzullah Efendi.