On September 12, 1683, a relief army commanded by King John III Sobieski of Poland came down off the Kahlenberg and attacked the Ottoman force besieging Vienna. The city had been surrounded since mid-July and its walls had been mined and breached in places. By the end of the day the Ottoman army was in retreat and its camp, in front of the city, had been abandoned intact.
The Ottoman grand vizier, Kara Mustafa, had brought an army that modern estimates put at well over 100,000 with around 150 guns, and he had spent the siege digging approach trenches and blowing mines rather than storming, which is a defensible way to take a fortress and was the wrong way to take a city whose garrison was being resupplied and reinforced. The garrison under Ernst Rudiger von Starhemberg held out for nearly two months with its numbers reduced by disease and casualties.
Sobieski had 25,000 men. With the Imperial forces under Charles of Lorraine and the Bavarian, Saxon, Franconian and Swabian contingents, the total came to something over 70,000. Command of the whole operation was given to Sobieski because his was by far the largest contingent and because the Habsburgs had no better general available. The plan was to take the high ground on the Turkish left and then come down the slope.
The fighting that broke the Ottoman line is what everyone remembers. Then the cavalry went in. It was late afternoon, after hours of infantry work on the slopes and in the vineyards. The Polish heavy horse, the winged hussars, came off the top of the ridge, with the Imperial cavalry on their left. It is usually called the largest cavalry charge in European history. The numbers are disputed. The effect was that the Turkish line folded, and the camp was overrun before dark.
Kara Mustafa was executed at Belgrade in December on the sultan's order. The defeat was the end of Ottoman expansion into central Europe and the beginning of the long retreat: the Holy League of Austria, Poland and Venice kept the war going for sixteen years, and the Treaty of Karlowitz in 1699 gave Hungary and Transylvania to the Habsburgs. Legend has it that sacks of coffee left in the abandoned camp were the origin of the Viennese coffee house; the story is probably too neat, and the first documented Viennese coffee house dates to 1685.