The Persians captured Athens after Thermopylae opened the route south. Once Leonidas's Greek force was defeated in 480 BCE, Xerxes I's army moved through Boeotia and into Attica, leaving Athens exposed.
The Athenians had already evacuated most of the city's population, with many refugees taken to Salamis by the Greek fleet. A smaller group barricaded itself on the Acropolis, but Persian troops eventually overcame them. Xerxes then ordered Athens to be sacked and burned, including important buildings on the Acropolis such as the Old Temple of Athena and the Older Parthenon.
This was a Persian occupation, not the end of the war. The Greek fleet soon defeated the Persian navy at Salamis, forcing Xerxes to withdraw much of his army. Athens was later retaken, and the Greek victory at Plataea in 479 BCE ended the invasion. A common mix-up is to confuse this capture with the earlier Persian attack on Athens during the first invasion, which ended with the Greek victory at Marathon in 490 BCE.