Hundreds of people protested in front of the Japanese embassy in Beijing on Saturday, throwing objects at the building as police struggled to keep control, amid growing tensions between Asia's two biggest economies over a group of disputed islands.
On Tuesday, Japan brushed off stern warnings from China and said it had bought the islands, called Senkaku in Japan and Diaoyu in China, from a private Japanese owner.
In Shanghai, streets around the Japanese consulate, in the western part of town, were cordoned off on Saturday. Hundreds of police let small groups of people in at a time to protest.
There have been smaller, better-behaved protests in front of the embassy located in an eastern part of Beijing for most of the week.
The long-running territorial dispute flared last month after Japan detained a group of Chinese activists who had landed on the islands.
Diplomats say Tokyo and Beijing would prefer to keep the row from spiralling out of control, but with China facing a once-in-a-decade leadership change, an election looming in Japan and mutual mistrust deep, managing the feud could be difficult.
The uninhabited islets were at the centre of a chill between Beijing and Tokyo in 2010, after Japan arrested a Chinese trawler captain whose boat collided with Japanese Coast Guard vessels in the area.
Sino-Japanese relations have long been plagued by China's bitter memories of Japan's military aggression in the 1930s and 1940s and present rivalry over resources and regional clout.