The government had said that the term of the parliament or Constituent Assembly, which was elected in 2008, should be extended by one year.
However, the Maoists, who hold the greatest number of seats in parliament, had demanded that the prime minister resign and allow them to lead a new coalition administration in return for the extension.
Al Jazeera's Hamish MacDonald, reporting from Kathmandu, said the developments were significant because they came at the "very last possible moment".
"It was not just the assembly that expired after that deadline, but all laws governing this country," he said.
"They’ve managed - just- to rescue a deal, extending the term of the Constituent Assembly.
"The prime minister has agreed to step down, he'll do so only once a consensus, or national unity government is formed.
"It's likely that the Maoists will have a big part to play in that because they are the largest single party in the parliament."
The Nepali Congress and the Communist Party of Nepal (UML), the other main political parties, had pushed for varied concessions from the Maoists in order to come to an agreement.
The UN urged for all sides on Thursday to come to an agreement in the interests of the peace process established in 2006 after a decade-long civil war.
"The constituent assembly and its progress to date toward the adoption of Nepal's new constitution represent a significant and hard-won achievement of the peace process," a UN statement said.
After changing from a monarchy to a republic in 2007, the Maoists won parliamentary elections in 2008. However, their rule lasted only nine months and they were left out of the succeeding coalition.
The current CA had failed to agree on the wording of a new constitution.