BEIJING, JULY 3 -- Two of the world's most populous nations, China and Indonesia, today announced an agreement to restore diplomatic relations after 23 years of estrangement, giving China a major diplomatic boost at a time when it is struggling against continuing international condemnation of last year's crackdown on dissent here.

As part of the new agreement, Premier Li Peng soon will visit Indonesia. Li is unwelcome in many countries because of his role in last spring's military crackdown on protesters demanding democracy in China.

A joint communique issued by the two governments said they will resume diplomatic relations Aug. 8. The announcement was made following three days of talks between Chinese Foreign Minister Qian Qichen and Indonesian Foreign Minister Ali Alatas.

The agreement is expected to bolster Indonesia's regional and international role and ultimately increase its trade relations with China.

Staunchly anti-communist Indonesia, with an estimated population of 178.4 million, was the last major nation in Asia to resist reestablishing diplomatic ties with China -- a country with an estimated 1.1 billion people. Singapore, whose population is primarily Chinese, has said it would not restore ties until Indonesia did. It will be the last of the Southeast Asian states to do so.

Foreign Minister Qian announced that China and Singapore are preparing to establish full diplomatic relations. At the moment, the two countries maintain unofficial trade offices.

ndonesia suspended relations with Beijing in 1967, two years after crushing a communist-led coup that the Indonesians claimed had Chinese backing. China has denied involvement in the coup attempt, but the Indonesians have insisted that the Communist Party of Indonesia received strong support from Beijing.

In February, the two countries agreed to open negotiations to restore diplomatic ties when Indonesia's President Suharto met with Foreign Minister Qian in Tokyo.

Qian said during that meeting China would not interfere in Indonesian affairs -- a statement required by Indonesia as a precondition for renewing relations. Indonesia regards China's pledge not to intervene as important, because some Indonesian officials and military officers harbor a deep distrust of China. They particularly fear that Beijing might influence ethnic Chinese living in Indonesia.

Qian indicated that China has lost all interest in the Indonesian Communist Party. "We have no idea whether there is a Communist Party of Indonesia now, let alone having any relations with it," said Qian. Another key issue settled this week was the question of Indonesia's payment of debts to China.

An Indonesian source said an agreement signed by the two foreign ministers requires Indonesia to repay $84 million in loans. Indonesia received financial as well as military aid from China in the early 1960s when Indonesia was under President Sukarno's rule. Sukarno was replaced by Suharto, an army general, in 1967.

The new agreement with China is expected to enhance Suharto's position, as well Indonesia's, in the nonaligned movement. With Indonesia's diplomatic ties to China, hopes have been raised that Indonesia can play a decisive role in efforts to end the war in Cambodia. Indonesia's support of a number of Cambodian peace initiatives has been hampered by its poort relations with China, which backs Cambodia's Khmer Rouge guerrilla force.