The pact also paves the way for Maoists to join an interim government and parliament, seen as crucial steps to a permanent peace after a decade of deadly civil conflict.
"The Nepali people want peace and democracy. This agreement is a significant step in this direction," Prakash Sharan Mahat, a senior leader of the Nepali Congress (Democratic), a member of the ruling seven-party alliance, said.
"The rebels will be kept in camps where cameras and other mechanisms will be installed to monitor the arms," Mahat said, adding: "An equal number of arms held by the government army will also be locked."
The agreement was signed after two days of intense negotiations by Girija Prasad Koirala, the prime minister, and Maoist chief Prachanda, who were supported by negotiators from both sides as well as leaders of the ruling alliance.
The Maoists, who have proven themselves to be tough and adept negotiators as well as fighters, showed rare optimism.
"This is a historic agreement. It will contribute in ending the conflict and solving the problems," senior Maoist leader Ananta said.
A joint statement signed by Prachanda and Koirala said there would be 28 camps across the landlocked country to hold the Maoist fighters.
The statement also said: "Both sides will set up an interim legislature including the Maoists and dissolve the existing parliament."
The pact manages to get the Maoists - who have fought for a decade to overthrow the monarchy - to agree to allow the king to continue in an almost powerless form until a constituent assembly takes a final decision on his future after it is elected in 2007.
Earlier, the Maoists had been demanding the abolition or suspension of the monarchy before the elections to the assembly.
"The first meeting of a constituent assembly will take a decision about the future of monarchy," Mahat said.
The assembly will prepare a new constitution which was a key demand of the Maoists to end their revolt.
The rebels and the government announced a truce and began negotiations soon after King Gyanendra ceded absolute power following violent street protests in April that left at least 22 people dead and thousands wounded.
But a dispute over disarming the rebel army had remained a sticking point because the Maoists had refused to lay down their guns before elections to the assembly.
The Maoists have 35,000 fighters and a militia numbering around 100,000.