As to what /u/conradxu said, there wasn't a "Greece" as such, but various greek city states. The Greco-Persian Wars weren't Greeks vs Persians, but Greeks vs Greeks + Persians. Around half the Greek city states were aligned with Persia during these wars and there were Greeks killing Greeks in these battles, as the Persian Imperial army had big contingents of Greek heavy infantry.
The Spartans didn't fight at Marathon, but they did send 300 a long with several thousand other Greeks to block the narrow path at Hells Gate. Spartans also fought at the following Battle of Plataea which occurred around a year after the Battle of Thermopylae.
After the Greco-Persian Wars ended, the Athenians rebuilt Athens (Persia sacked Athens twice after the Battle of Thermopylae), and Athens and Sparta shortly afterwards fought a war against each other called the Peloponnesian War. Sparta had a superior military on land, but the Athenians had a far superior navy. Persia supplied funding to Sparta to build their navy and Sparta was hence able to defeat the Athenian navy and win the war. So as you can see, it was really a complicated time.
As an amendment to your question.
During the reign of the Persian empire under Darius and Xerxes approximately between 500 and 400BC. There was no formation of Greece. There was only the greek states. Also, it was more Athens and her allies against the Persian empire.