BEIJING — Signaling a potential thaw in their long-frozen relations, China and Japan announced Friday that they would talk to each other about their competing positions on islands in the East China Sea and would gradually resume diplomatic and security discussions.

With that step, the leaders of both countries gave the first public declaration that they are trying to roll back a prolonged standoff that has inflamed nationalist sentiments, damaged economic ties and at times appeared to bring them close to military conflict.

The agreement was announced in similarly worded statements by both sides acknowledging that “different positions exist” over the islands known in China as the Diaoyu and in Japan as the Senkaku.

Even acknowledging differences counts as something of a breakthrough in the standoff. Japan has long declined to discuss China’s claim to sovereignty over the islands, which Tokyo has controlled for most years since the 1880s.