Japan and the Soviet Union declared today that after eight years they have resumed negotiations toward a peace treaty that would terminate formally the enmity of World War II.

Japanese officials said it was possible because the Soviets had backed off from their stance of refusing to discuss Japan's claim to a group of islands that Soviet troops seized in 1945.

But the Soviet side said there had been no change in its position that the islands would not be returned.

The announcement of the treaty talks resumption grew out of five days of consultations in Tokyo that Soviet Foreign Minister Eduard Shevardnadze completed today. He was the first Soviet foreign minister to come here in a decade.

"The reality is that this time with Shevardnadze we negotiated the territorial issue," Japanese Foreign Minister Shintaro Abe told reporters this afternoon.

In a press conference this morning, Shevardnadze said that the two sides had had "heated discussions" on the issue. Presumably that would not have been possible had the Soviets stuck to their old stance.

But Shevardnadze also said -- and Abe confirmed -- that in the talks he had restated the Soviet Union's position that it has historic and legal rights to the islands, located just off Japan's northernmost main island of Hokkaido, and will not return them.

Still, one Soviet analyst saw a shift in his side's position. "It's . . . a compromise," said Mikhail Efimov, chief of the Tokyo branch of the Soviet government's Novosti press agency. "In previous years, we didn't discuss the territorial issue because we didn't acknowledge this issue existed."

It is unlikely that the talks will bring significant improvement soon to the relations between the two countries, which are historic rivals in the region.

However, the resumption was hailed by both as a step forward in the detente that has been developing between them since Mikhail Gorbachev came to power in the Soviet Union.

Japan and the Soviet Union fought each other briefly in the closing days of World War II. They normalized diplomatic relations in 1956 but, despite periodic discussions, never have signed a peace treaty.

Japan says it will never sign one unless provisions are made for the return of the islands which it says are traditionally part of Japan and should not have been taken in the division of the empire Japan had amassed by force before and during the war. The Soviet claim is that the islands are part of the Kuriles chain.

Soviet commentators suggest that the islands are not important enough to be an obstacle to better relations and that Japan, which is a close military ally of the United States, uses them as a pretext to keep relations cool.

A joint communique released today said that the treaty discussions were based on a 1973 joint statement by the countries' leaders at the time, Kakuei Tanaka and Leonid Brezhnev. It referred to "unresolved questions" remaining from World War II that would be solved as part of a peace treaty.

Japanese officials say that Brezhnev assured Tanaka that Moscow considered the islands to be among those questions. The Soviets, however, deny it.

This evening, Japanese officials cited the reference to the 1973 agreement as a victory for their side, because they contend that the Soviets acknowledged their claim in it.