South Korea says it has agreed to halt propaganda broadcasts at noon after North Korea expressed regret over a recent land mine blast that maimed two South Korean troops.
South Korean presidential security adviser Kim Kwan-jin made the announcement in a televised briefing early on Tuesday, after more than 30 hours of talks with North Korea ended.
The talks were the second round of negotiations the rival Koreas began on Saturday after events at their heavily guarded border pushed them to the brink of a possible military confrontation.
Mr Kim says the two Koreas have also agreed to hold talks to improve their ties soon in either Seoul or Pyongyang.
During the talks at the border village of Panmunjom, North Korea also agreed to lift a "quasi-state of war" that it had declared last week, chief South Korean negotiator and presidential security adviser Kim Kwan-jin told a televised briefing.
Mr Kim said the two Koreas have also agreed to resume reunions of families separated by war in September. He said the countries will hold talks to improve their ties soon in either Seoul or Pyongyang.
The North's Korean Central News Agency also released the same details.
The announcement came after the second round of negotiations the rivals began on Saturday after events at their heavily guarded border pushed them towards a possible military confrontation.
Both sides had wanted a face-saving way to avoid an escalation that could lead to bloodshed, especially the North, which is outmatched militarily by Seoul and its ally, the United States.
The announcement came after South Korean president Park Geun-hye on Monday said that without a clear North Korean apology for the mine attack that maimed two soldiers, the anti-Pyongyang propaganda broadcasts that infuriate the North would continue.
Mr Kim said the loudspeaker campaign, which began after the blast, would stop at noon on Tuesday unless an "abnormal" event happens.
Pyongyang had denied involvement in the land mine explosions and rejected Seoul's report that Pyongyang launched an artillery barrage last week. It was not clear whether North Korea's expression of regret meant it was now admitting its involvement.
Even as the two countries held talks over the weekend, South Korea's military said North Korea continued to prepare for a fight, moving unusual numbers of troops and submarines to the border.
These were the highest-level talks between the two Koreas in a year. Just the fact that senior officials from countries that have spent recent days vowing to destroy each other were sitting together at a table in Panmunjom, the border enclave where the 1953 armistice ending fighting in the Korean War was agreed to, was something of a victory.
The length of the talks was not unusual. While the Koreas often have difficulty agreeing to talks, once they do, overlong sessions are often the rule. After decades of animosity and bloodshed, finding common ground is a challenge.
The decision to hold talks came hours ahead of a Saturday deadline set by North Korea for the South to dismantle the propaganda loudspeakers. North Korea had declared that its frontline troops were in full war readiness and prepared to go to battle if Seoul did not back down.
An official from Seoul's defence ministry said about 70% of the North's more than 70 submarines and undersea vehicles had left their bases and were undetectable by the South Korean military as of Saturday. The official also said the North had doubled the strength of its frontline artillery forces since the start of the talks on Saturday evening.
It was not known whether North Korea pulled back troops from the border after the agreement was announced.
The standoff started with the explosions of land mines on the southern side of the Demilitarised Zone between the Koreas that Seoul says were planted by North Korea. In response, the South resumed anti-Pyongyang propaganda broadcasts for the first time in 11 years, infuriating the North, which is extremely sensitive to any criticism of its authoritarian system.
Analysts said the North fears that the broadcasts could demoralise its frontline troops and inspire them to defect.
On Thursday, South Korea's military fired dozens of artillery rounds across the border in response to what Seoul said were North Korean artillery strikes meant to back up an earlier threat to attack the loudspeakers.
At the talks, Mr Kim and unification minister Hong Yong-pyo sat down with Hwang Pyong So, the top political officer for the Korean People's Army, and Kim Yang Gon, a senior North Korean official responsible for South Korean affairs. Mr Hwang is considered by outside analysts to be North Korea's second most important official after supreme leader Kim Jong Un.
UN secretary-general Ban Ki-moon quickly issued a statement welcoming the news of an agreement and stressing the importance of its full implementation.
"I strongly encourage humanitarian measures such as reunions of separated families to be regularised without being subject to political and security considerations," Mr Ban said. "I further hope that this hard-won momentum for inter-Korean dialogue will lead to the resumption of talks for addressing the nuclear issue."