The Chinese Foreign Ministry also issued a similar statement announcing the agreement on Tuesday.

For months, Seoul and Beijing appeared to have been deadlocked over their dispute over Thaad. China has insisted that South Korea remove the system, saying it could not tolerate its powerful radar on its door step. But South Korea said the Thaad system was essential to defending itself and American troops in South Korea from the growing nuclear and missile threats from North Korea, and called the matter nonnegotiable as long as those threats did not subside.

The breakthrough came only days after President Xi Jinping of China emerged triumphant from the Communist Party congress this month, more confident than ever in his hold on power and in the pursuit of his foreign policy. The inauguration of Moon Jae-in, a liberal president of South Korea who has stressed the importance of relations with China, his country’s biggest trading partner, in May has also helped thaw relations.

In a separate statement, Mr. Moon’s office said he would hold a summit meeting with Mr. Xi on the sidelines of a summit of Asia-Pacific Economic Cooperation countries in Vietnam on Nov. 10-11.

Foreign Minister Kang Kyung-wha of South Korea first hinted at a possible breakthrough on Monday, when she said that despite the Thaad deployment, South Korea had no intention of joining the United States’ efforts to build a regionwide missile-defense system aimed at countering China’s expansion of its military capabilities. Ms. Kang also said South Korea would not accept any additional Thaad batteries.

She also reiterated that South Korea would not enter any trilateral military alliance with the United States and Japan, something that Mr. Xi raised concerns about when he met Mr. Moon in July. The United States remains South Korea’s most important military ally.