President Maithripala Sirisena shocked the nation by sacking parliament and calling snap elections on Friday.
The dramatic decision came two weeks after Mr Sirisena fired his prime minister and replaced him with the country's former leader.
But his actions have been called unconstitutional.
Ranil Wickremesinghe, the ousted PM, had refused to give way to his named successor, Mahinda Rajapaksa, and had called for MPs to vote on who they believed was the rightful premier.
Correspondents said the president and Mr Rajapaksa decided to called the snap election because they did not have enough support in parliament for their new government.
Mr Wickremesinghe's United National Party (UNP) said the move was illegal and it and other parties filed petitions with the Supreme Court.
Its order means that elections, announced for 5 January, have been put on hold.
Hundreds of heavily-armed police had been deployed to the court ahead of Tuesday's decision and UNP supporters set off firecrackers in celebration as news of the order filtered out.
"The people have won their first victory. Let's go forward and re-establish the sovereignty of the people in our beloved country," tweeted Mr Wickremesinghe.
What's the background?
Mr Sirisena, the president, and Mr Wickremesinghe, the sacked prime minister, joined forces in the 2015 election to defeat the then long-time president, Mr Rajapaksa.
But their uneasy coalition has since fractured and on 26 October Mr Sirisena announced he was sacking the PM and replacing him with Mr Rajapaksa.
The pair had reportedly clashed in cabinet recently over government plans to lease a port to India.
he sacking left the country with two people claiming to run the government, and Mr Wickremesinghe refused to leave his residence, Temple Trees.
President Sirisena had agreed to convene parliament on 14 November but then dramatically reversed course last Friday, when he said he was dissolving parliament.
It's unclear if parliament will now convene on Wednesday as originally planned but senior UNP officials have told the BBC that its MPs will show up.
Who is Rajapaksa?
Mahinda Rajapaksa is a popular but controversial figure. As president, he ended the decades-long civil war in 2009, but faced criticism for the means by which he achieved victory - many thousands of Tamil civilians are thought to have been killed by government forces in the final months of the fighting.
The military has always denied this, but it has remained a bitterly contentious issue and been the subject of intense scrutiny.
Mr Rajapaksa also signed several large infrastructural deals with China when he was in office - saddling Sri Lanka with billions of dollars in debt. The former president and his inner circle are also accused of corruption, which they deny.
(Except for the headline, this story, originally published by bbc.com has not been edited by SLM staff)