China and Japan ended six years of sporadic negotiations last night and signed a peace and friendship treaty in Peking.

Japanese officials here asserted that China had made significant conncessions during the bargaining, including an agreement that there would be no recurrence of incidents such as those earlier this year near a chain of islands claimed by both countries but held by Japan.

The treaty was signed by officials of the two countries early in the evening in a ceremony at Peking's Great Hall of the People.

It was promptly hailed by Prime Minister Takeo Fukuda and endorsed by all major political parties except Japan's Communist Party, which with-held judgment.

The signing was witnessed by millions of Japanese who watched it on television via satellite.

The importance the Chinese attached to the treaty was demonstrated when Premier Hua Kuo-feng, who is also chairman of the Chinese Communist Party, and Vice Premier Teng Hsiao-ping, party vice chairman, attended the signing ceremony.

The treaty had been under intermittent discussion since 1972, when the two countries restored diplomatic relations. It had been delayed because of Japan's concern that it would complicate relations with the Soviet Union, China's ideological foe.

The final version contained the major point sought by China as part of its capaign to oppose expansion of Soviet influence. One clause said that both countries are opposed to any efforts by other countries to establish "hegemony," or dominance, in Asia or any other region. In China's view, that proviso is aimed at the Soviet Union.

Another clause, demanded by Japan, however states that the treaty does not affect either country's position regarding relations with third countries. In Japan's eyes, that clause means the treaty is not directed against the Soviet Union.

The Soviets have repeatedly warned Japan they would consider such a treaty an unfriendly act and have hinted vaguely that it might be required to reexamine is policies toward Japan if the treaty were signed.

The Soviet Russian ambassador, Dmitri Polyansky, has been recalled to Moscow for consultations and the speculation here is that he will remain there for some time as a demonstration of Soviet displeasure. Asked last night when he was expected to return, a Japanese Foreign Ministry official replied, "That's what we would like to know."

In briefings with reporters, Japanese officials contended that China had made a major concession in including the clause specifying that the treaty does not affect third countries.

In a statement from Peking, where he had signed the treaty for Japan, Foreign Minister Sunao Sonoda also hinted that China had made other moves favorable to his country.

The first involved the Senkaku Islands, a tiny chain that is claimed by Japan, China and Taiwan. Last April, armed Chinese fishing boats had swarmed into the waters near the islands in what seemed a deliberate, although unexplained, provocation.

Sonoda said last night that the Chinese had promised there would be "no recurrence" of the Senkaku incident.

The statement was viewed here as an effort to obtain support for the treaty in the Liberal Democratic Party's right wing, some members of which had demanded that the Senkaku incident be pursued in the negotiations.

Sonoda also said it was his "strong impression" that China will take the "necessary measures" to terminate the Sino-Soviet Treaty next year. That long-outdated treaty, written when Peking and Moscow were on friendlier terms, names Japan as their common enemy and promises Soviet aid for China in the event of a Japanese attack.

Almost all the key parts of the negotiations favorable to Japan had been leaked in Peking to the Japanese press as the final discussions were held there. As a result, the Fukuda government reaped a steady harvest of favorable headlines making it appear Japan had won victory after victory at the bargaining table.

There was no indication of what, if anything, Japan had promised China in exchange for the favors. However, during the negotiations it was suddenly announced that a high Japanese official would go to Peking to discuss ways of financing the growing trade between the two countries.

Japan is already China's leading trading partner. Two-way trade reached $2.14 billion in the first half of this year, up fom $1.5 billion for the same period last year.

Total bilateral trade this year is expected to reach $5.6 billion, and greatly favors Japan, which is supplying large portions of the plants, equipment and expertise that China needs for its program to inject modern techniques into its industrial and manfacturing sectors.

China is known to be seeking loans or other resources to buy from Japan a great quantity of technology and equipment with which to begin new economic development plan. There was speculation that will be the subject when Toshio Komoto, minister of international trade and industry, goes to Peking next month.

A Japanese official acknowledged last night that the question of Komoto's mission arose out of the treaty discussions in Peking. He denied, nowever, that there was any direct connection between the terms of the treaty and Komoto's planned visit.

The treaty will probably be submitted to a special session of the Japanese parliament in September for ratification. Chinese Communist Party Vice Chairman Teng has been invited to Todyo to exchange the ratified documents. A news service report from Peking indicated he would accept the invitation.

The treaty pledges both countries to observe "mutual respect" for each other's sovereignty and noninterference in each other's internal affairs. Both promise to settle disputes without resort to force or threats.