Two of the world's largest nations, China and Indonesia, signed an agreement today to begin trading with each other directly once again for the first time in nearly two decades.

The official New China News Agency said yesterday in a report from Hong Kong that the new agreement, described as a memorandum of understanding, constitutes a "major breakthrough" in relations between the two countries.

Diplomats here cautioned, however, that given the long history of Indonesian animosity toward China, any progress toward the establishment of full diplomatic relations between the two nations was likely to come slowly and incrementally.

A Chinese delegation headed by Wang Yaoling, chairman of the China Council for the Promotion of International Trade, met with an Indonesian delegation in Singapore today to sign the trade agreement.

A western diplomat said that Indonesia appeared to be motivated primarily by a desire to compete for export sales in a Chinese market that has opened up dramatically in recent years. Indonesian Foreign Minister Mochtar Kusumaatmadja said last May of China's open-door economic policy that "Indonesia has to adjust to this new development in China. We cannot ignore it."

Indonesia suspended relations with Peking in 1967, two years after crushing a Communist-led coup that the Indonesians claimed had Chinese support. Emotions still run high in Indonesia against China and the ethnic Chinese living in Indonesia.

Indonesia's President Suharto has said that there will be no diplomatic relations until China formally states that it will not support Communist movements in the region. Chinese Communist Party General Secretary Hu Yaobang said last April during a trip to Australia that the Chinese have no ties with Indonesian Communists and would be unable to establish such ties even if they wanted to.

Indonesia's exports to China in 1983 were valued at about $33.5 million annually, while China's exports to Indonesia via Hong Kong came to about $208 million.