In 371 BC, on the 6th of July, the Spartan army lost the battle of Leuctra. In the process they lost their dominance as a land army and lost the myth of the unbeatable army which had lasted since the defense to the death at Thermopylae in 480 BC and the defeat of Persia at Platea in 479 BC.
A loss in battle 100 years before was not a death knell for Sparta, so what went so wrong in 371 BC? To answer that you must understand the economics of the Spartan system.
Spartan boys were taken from their homes as children and raised in barracks as soldiers. Each soldier was maintained in his position as a military professional by his estate. The estates, large farms, were worked by slaves and the Spartan system was entirely reliant upon the goodwill of slaves to function. Initially there were a large number of small estates. Over time estates became larger and the number of soldier citizens diminished. At the time of the battle of Platea the Helots were said to outnumber the Spartans by 7 to 1.
At any given time Sparta could only field about 5,000 elite troops. These ‘special forces’ relied on lesser trained allies and even slave soldiers to supply weight of numbers. The Spartan elite were the greatest and best trained soldiers in the world in their day. On the battlefield they were marked by their red cloaks and their silent drill. While other armies roared and sang and shouted the Spartans advanced in a silent wall of death.
Because there were so few elite Spartans, any serious loss of their numbers could have serious repercussions. There were simply not enough estates and enough slaves to support a larger Spartan elite. They tried to bridge this manpower gap by according a special elevated status to the sons of Spartans born to Helot mothers. These boys could serve as middle level administrators and auxiliary soldiers. But they could never rise to the rank of soldier citizen.
The nature of Greek warfare also helped to underscore the immortality of the Spartans. Greek heavy infantry fought in a phalanx, a tightly packed line of spear men, ten to twelve ranks deep. Your own shield, the great round pylon, protected your left hand side. For protection on the right you relied on the shield of your neighbor. The hoplites tended to lean in to the right to stay protected by their neighbors shield. As a result there was a tendency for the phalanx to move gradually to the right. To prevent this impetus armies would put their best trained and most veteran troops on the right flank. This was the place of honour. These troops would stand firm and prevent right hand drift.
In any battle with allies, the Spartan elite held the right flank. This meant that they were facing the weak flank of their enemy. The success of the Spartan elite was continually reinforced by facing them against weak foes.
The Theban general, Epaminondas, introduced three ground breaking innovations to the Greek way of war. Firstly he placed his strongest troops in the left flank, directly facing the Spartans. Secondly he arranged them in a phalanx 50 lines deep. This provided an irresistible weight of numbers against the Spartan phalanx of only 12 deep. Finally, he organised his remaining troops in echelon instead of phalanx. They formed a series of blocks stepped further and further away from the Spartan line. This denied the Spartan left flank contact with the weaker right flank of the Thebans.
At Leuctra the Spartan elite were smashed. They lost between 1,000 and 4,000 troops. The important thing is that most of the losses were elite Spartan troops instead of allies and slave soldiers. These were irreplaceable Spartan Citizen soldiers, the product of 20 years of training.
Leuctra also shattered the illusion of invincibility of the Spartan troops. The spell was broken, and the economic system was broken. Sparta declined and became a bucolic backwater and an economic dead end.
At the same time, in the north, Philip of Macedon paid close attention to the Theban tactics. The oblique line and the massed wedge became a trademark of the Macedonian war machine, and enabled Alexander to conquer the world.
Epitaph of Simonides at Thermopylae:
Go tell the Spartans, thou who passes by,
That here, obedient to their laws, we lie.