SEOUL, JULY 3 -- South Korea and North Korea agreed in principle today that their prime ministers should hold a historic meeting to discuss easing tensions on the peninsula, perhaps the most dangerous region in the world left over from the Cold War.

Resuming contacts at their border that were broken off in February, negotiators agreed to sign an accord by July 26 that will set an agenda and date for the proposed prime ministers' meeting. The session, which would be the first high-level contact between the Koreas since 1972, could take place in Seoul by the end of August, South Korean officials said.

The preliminary agreement sparked excitement and hope in South Korea, where the stock market surged as newspapers reported a potential breakthrough in the frozen relations between North and South, which have had minimal contacts since the Korean War ended in 1953. There has been no mail or phone service between the countries since then, and only a handful of separated families have been reunited.

The climate for a North-South rapprochement appears better now than in the past, primarily because of increasing international pressure on North Korea. In a major diplomatic rebuff to the North, Soviet President Mikhail Gorbachev met South Korean President Roh Tae Woo last month, and as a result Seoul and Moscow are headed toward full diplomatic ties.

But some officials said it would be wise to exercise caution about expecting too much. In the last four decades, the two Koreas have neared agreement on important exchanges but then backed off once sensitive issues were raised or when one side felt it was being lured into a propaganda trap. The previous high-level contact -- when South Korea's intelligence chief made a secret trip to North Korea in 1972 -- failed to yield any enduring legacy of dialogue.

"The two sides are far apart on some issues," said one government official. "It's difficult to expect a breakthrough."

Today's meeting at the border village of Panmunjom was unexpectedly brief -- about an hour -- and lacked the usual diatribes that often constitute inter-Korean dialogue. The negotiators from Communist North Korea approved the timetable after the South Koreans made a key concession by agreeing to place arms control and other military issues at the top of the agenda for discussion by the prime ministers.

"It's natural that the talks have been settled because we showed concessions and North Korea faces problems at home and abroad," said Song Han Ho, South Korea's chief negotiator.

North Korea's negotiator, Paik Nam Jun, also was upbeat, telling reporters: "Progress made in this preparatory meeting will serve as a landmark for reunification and mark a historic turning point."

But an official who advocated caution about expecting too much noted that while South Korea has broadly agreed to include military issues on the agenda, there is little common ground on arms-control proposals. Seoul insists confidence-building measures be undertaken before military cuts. North Korea wants to reduce soldiers and arms first and demands that the annual U.S.-South Korean military exercises be canceled and U.S. troops withdrawn from South Korea.

South Korea's trade with China, North Korea's other key ally, is booming but Beijing is less willing to publicly rebuke one of its last ideological supporters. Nonetheless, China is believed to be quietly supporting what the Soviet Union is calling for: the end of North Korea's hostile stance toward South Korea and the United States.

The political stick from the North's wavering allies is accompanied by a carrot from its longtime foes. Washington and Pyongyang have begun modest diplomatic contacts in Beijing that led in May to the first exchange of American remains from the Korean War in more than three decades. South Korea is offering economic exchanges and aid to the North, whose command economy is facing increased troubles.

"It looks like we are going to have a prime ministers' meeting," said presidential adviser Lee Hong Koo, a former minister of unification.

Lee stressed that the meeting would be only one step in what would likely be a gradual process of coaxing North Korea into cooperation.