China and Japan sealed their new friendship treaty with pledges of peace and cooperation yesterday to bring a formal end to four decades of hostility between the two most important nations of Asia.

In a day of decorons meetings touched by historical irony, the two countries' representatives exchanged ratification documents and launched into a round of talks and receptions underscoring the restoration of an ancient amity marred by two wars in the last century.

The main guest and star witness to the agreement was China's Vice Premier Teng Hsio-ping, who arrived here Sunday leading the first high-level Chinese delegation to Japan since World War II.

Teng told Japanese Prime Minister Takeo Fukuda the treaty should ensure peace between the two countries for their descendants. But he added a characteristically gloomy view that the world is headed for war because the Soviet Union is expanding its armed power.

Fukuda virtually apologized for the Japanese invasion of China in the 1930s, said it would never happen again and in a roundabout way underscored his country's policy of moving closer to China than to the Soviet Union.

Moving quickly through a heavy round of appearances, the 74-year-old Chinese leader and his wife were guests of honor at a luncheon given by Emperor Hirohito, against whose imperial armies Teng had fought in the 1930s and 1940s. While they ate, an orchestra played ancient court music, including numbers first introduced into Japan from China centuries ago.

A spokesman for the imperial household said later that both men had spoken of putting behind them for good a past that includes a conflict at the end of the 19th century as well as the 1930s invasions that led into World War II and the era of postwar hostility.

Teng told the emperor, according to the spokesman, that China will attempt to build peaceful relations and let bygones be bygones. The emperor replied that the unhappy part of Chinese-Japanese relations is in the past and that he hopes for a deepening friendship. Teng nodded in agreement.

In a meeting with Fukuda that lasted nearly two hours, Teng described the Japan-China treaty as "a very good thing for the peace of the world."

Then he launched into a critique of East-West detente by warning of the Soviet Union's military expansion. According to Japanese Chief Cabinet Secretary Shintaro Abe, who briefed reporters on the visit, Teng noted the U.S.-Soviet effort to improve relations and reduce nuclear armament.

"But it doens't seem very fruitful," Abe quoted Teng as saying. The Soviets, he added, are expanding with nuclear arms and conventional weapons.

Abe said Teng and Fukuda discussed U.S. relations with China. He declined to give any details but indicated that Teng had registered no objection to Japan's continuing its military relationship with the United States. Fukuda told Teng that Japan does not intend to become a military power in its own right and plans to maintain its security treaty with the United States, Abe recounted.

The treaty that formally came into effect with the exchange of ratifications yesterday is a brief document of sporadic negotiations. It is important mainly for its symbolic sealing of a friendship between two former enemies but also is regarded as the open door to new trade between Japan and China with China seeking plants and [WORD ILLEGIBLE] industrial [WORD ILLEGIBLE]

Its main nature is an [WORDS ILLEGIBLE] clause that declared both countries oppose the dominance of any third country. To China, the target is the Soviet Union. But Japan, not wishing to anger the Soviet Union, tries to contend that the clause is not aimed at any specific country. Each country has stressed its own interpretation and the clause has thrown a chill over Soviet-Japan relations.

With his customary indirectness, Fukuda yesterday dropped a remark seemingly designed to assure China that it ranks aheed of the Soviet Union in Japans diplomatic affections now [WORD ILLEGIBLE] the treaty has been ratified.

Officially, [WORD ILLEGIBLE] maintains what it calls an "omnidirectional" foreign policy that permits it to be friends with every country. Fukuda mentioned that "omnidirectional" policy to Teng and added: "But this does not mean that the distances with all countries are the same."

Fukuda touched on economic problems, saying Japan would like to cooperate with China to end the world recession. Teng promptly seized on the opportunity to bid for Japan's economic support. He said that many Asian countries expect Japanese assistance and added that his people would be "relieved" to have Japan "cooperate with us postively."

Teng's visit has excited Japan, evoking a gush of adulation from the press, and the government has been hard-pressed to handle an avalanche of requests for invitations to the various lunches and banquets this week.