The 300 were able to defeat hugely superior numbers due to a combination of factors: they WERE superb soldiers and they had a fanatical tradition of fierceness and courage in the face of any foe. Finally, and perhaps most important, they defended a pass so narrow that it was impossible for the Persian forces to concentrate sufficient troops to overwhelm the 300. In the age of the sword and spear, your attack is only as good as the number of points you can present directly at enemy flesh. If the gap could be filled by a hundred men, the Persians could only face them with a hundred men at a time.
Also there chosen tactic was the falanx formation, men shoulder width apart with shield and spear in multiple rows deep. While most engagement were short usually only minutes. They would rotate forward troops to the rear for rest during lulls or at timed intervals.
Also the spartans had superior armor and weapons, thier shield were wood covered in copper. The persian did not have that technology in great numbers.