North Korea has reversed its earlier decision and accepted South Korea's proposal to hold high-level military talks.
The sudden about-face came on the last day of inter-Korean ministerial talks that ended in Pyongyang on Friday.
The four-day talks had earlier been bogged down over Seoul's request to hold general-level military talks within this month. South Korea wants to discuss ways to avoid possible naval clashes at the western sea border ahead of the crab catching high season in May and June.
Scores of sailors have been killed or wounded in recent years in clashes off the divided peninsula's west coast.
During the talks, North Korea had insisted that it would agree to such talks only when the South agrees to stop its annual joint military exercises with the United States.
Earlier on Friday, the South Korean delegation declared the talks had virtually broken down before flying back to Seoul.
The unexpected breakthrough came less than hours after the announcement of a joint statement in which the two sides pledged nothing more than to hold the next round of ministerial talks in August in Seoul.
As for the timing of the planned military talks, South Korea's chief delegate, Unification Minister Jeong Se-hyun, said no date was set for the talks but suggested that they could be held within this month.
But the two sides failed to agree on other pending bilateral issues, including holding the 10th reunion of family members who were separated in the Korean War.