Under the agreement, Maoist rebels agreed to confine their fighters and weapons to cantonments while government troops would be restricted to barracks, settling a major dispute between the two sides.
The agreement was reached at a meeting between Girija Prasad Koirala, Nepal's prime minister, and rebel leader Prachanda and his deputy Baburam Bhattarai.
Wednesday's meeting among the three was the first since the rebels warned earlier this week that the peace talks were on the verge of collapse.
The meeting was closed to the press and the rebel leaders did not speak to reporters after meeting Koirala and Krishna Sitaula, the home minister.
Bhattarai had earlier warned that peace talks faced collapse because of repeated violations of an agreement with the government. The rebels had refused to disarm and disband.
Attempts were also being made by government and rebel negotiators to agree on a joint letter to the United Nations by Wednesday.
UN peace negotiators who visited Nepal last week had given until the middle of this week for the two sides to reach an agreement before the world body would decide whether to step in as a mediator.
UN has given a deadline to the two
two sides to agree on a peace plan
The government side had earlier wanted rebel arms to be locked up before proposed elections; but the insurgents said they would only go as far as allowing the UN to supervise the weapons' safekeeping inside secured camps.
The two sides declared a ceasefire and began peace negotiations in April after weeks of pro-democracy demonstrations forced King Gyanendra to give up his authoritarian rule.