This long war between the two city states of Athens and Sparta, involved all of Greece, due to the networks of alliance that had been formed with them. In 477 BC, Athens had formed the Delian League, which had its treasury on the island of Delos, and which amounted to a huge naval empire.
The treasury that had been in the sacred precinct of Delos was moved by Periklis to Athens, when he became its ruler in 461 BC; it was this wealth that was used to carry out his monumental building project on the Acropolis, as well as fortifying the city against future attacks by extending its walls all the way to the port of Pireas. Meanwhile, Sparta controlled the Peloponnesian League.
The first of the two Peloponnesian Wars (431-421 BC) was set off by a conflict between Korkyra (Corfu) and Korinth (Corinth), with the Spartans allied with Corinth, and Athens with Korkyra. Athens suffered from its decision to withdraw behind its fortifications, leaving its navy to carry out the strategy of blockading the Peloponnese, as plague spread through the city and killed a third of the populace, including Periklis, though the blockade resulting in a truce between the two cities. The truce lasted eight years, till 413 BC, but then the battle began again when the Spartans supported Sicilian Syracuse against the Athenians, who had been carrying out a siege against it for three years.
The Spartans succeeded in ending the siege, and wiping out both the Athenian army and navy to boot, though Athens somehow mustered the wherewithal to fight another nine years, before the final surrender in 404 BC to Sparta, which set about tearing down the walls between the city and its port, abolishing the Delian League, and appropriating its ships.
The city state functioned less efficiently after this long war, partly due to the drain on resources and on political apathy, but perhaps more so due to the changing commercial picture, with expanded trade, stimulated by the invention of coinage in the 6th century BC,and by the threat looming from the north, from the kingdom of Macedonia.