It seems miraculous to me that a rag tag band of revolutionaries in a defeated occupied country could fight off the strongest nations of the day.
This is a little simplified, but basically, they didn’t.
The Turkish War of Independence was right on the heels of WW1 and the European powers – Britain, France and Italy – had very little motivation to fight, and past France’s lacklustre efforts for Cilicia they didn’t. Their efforts are characterised by withdrawals from their zones of control and repeated attempts to negotiate with the Turkish nationalists. While they had pretty considerable numbers of troops available, Greece was the only nation to really commit to fighting. I think I've read somewhere that Italy actually assisted in training and supplying some Turkish forces due to losing territorial disputes with the Greeks.
The Armenian’s also took advantage of the situation but I’m not as well versed in their contributions. A communist uprising and subsequent Soviet invasion knocked them out of the game by the end of 1920.
The Greeks seem to have underestimated the Turkish forces – I think they stated something like 3 months as the timeframe to take their objectives, before the war started. They had a numerical advantage and initially superior equipment to the Turks, but their economy couldn’t handle the long-term mobilisation of the army and they ran into serious logistical problems. They were also seriously hampered by political infighting at home – after Venizelos’ government was replaced and King Constantine recalled from exile, many of their more experienced leaders were replaced with less able Royalist officers. Other leaders resigned with the leadership change, with some causing problems at home.
The Turks had supply problems of their own – the dissolution of the Ottoman military and confiscation of their equipment left them in a bad situation – but were able to get considerable materiel assistance from the Soviet Union, who supported them against the European powers in hope of a Turkish ally/buffer state and due to the other powers interfering in the Russian civil war.
The Turks retreated and stalled Greek forces while recruiting more and more soldiers, until the former withdrew in the face of winter, inability to supply, communication problems and under fears of large-scale counterattacks. The Turkish forces eventually did counter-attack, and pretty much shattered the Greek forces and won the war at the Battle of Dumlupinar. The Greeks had numerical advantage, but the Turks had superior artillery, more cavalry and were able to better concentrate their forces against the Greek lines.
After this the remaining Greeks withdrew, as did French and Italian forces in the European Ottoman/Turkish territory. Britain postured for a bit then followed them. Afterwards the Treaty of Lausanne was signed, officially ending the conflict.