Waving the red-and-gold Vietnamese flag, raising their fists and shouting "Defend the homeland" and "Down with China," about 250 people rallied for one hour as police stood by before the protest was peacefully dispersed.
"We love our country. We protest the occupation of Truong Sa (Spratlys) and Hoang Sa (Paracels)," shouted the protesters, mostly students, who had gathered in Lenin Park across from the gated diplomatic mission.
The two archipelagos, considered strategic outposts in the South China Sea, have potential oil and gas reserves and rich fishing grounds.
The Spratlys are claimed in full or part by China, Vietnam, the Philippines, Malaysia, Brunei and Taiwan. All claimants except Brunei have troops based on the archipelago of more than 100 islets, reefs and atolls.
The Paracels -- which Chinese troops took from South Vietnamese forces in 1974 -- are also claimed by Vietnam and Taiwan.
The protest came after China last month set up the county-level Sansha administrative unit on Hainan island, which covers 2.6 million square kilometres (1 million square miles), mostly ocean, including the disputed isles.
The disputes stir strong passions in Vietnam, which remembers a millennium of Chinese rule and fought its last border war with China in 1979.
The two countries fought a brief naval battle in 1988 near one of the Spratly Island reefs, in which more than 50 Vietnamese sailors died.
The two communist-ruled countries normalised relations in 1991.
The issue has been hotly debated on blogs in Vietnam, and Vietnamese hackers at the weekend also defaced at least one Chinese government website with obscenities and a call to "stop invading" the islands.
"We need to do something with a long-term vision to settle this problem," said one protester, Hanoi engineering student Nguyen Duc Toan. "China is acting aggressively. We have a long history in Hoang Sa and Truong Sa."
The rally, which supported Vietnam's official stance, was tolerated by police, and local and foreign media were allowed to attend -- a rarity in Vietnam, where public protests are usually suppressed quickly.
Vietnam's foreign ministry earlier this month reiterated that it has "adequate historical evidence and sufficient legal basis to proclaim its sovereignty over both the Hoang Sa and Truong Sa archipelagos."
"Vietnam has a consistent policy of resolving sea-related disputes through peaceful negotiations and in accordance with international laws and practices," foreign ministry spokesman Le Dung said.
The islands have been flashpoints for years, and the number of disputes has risen as declining fish stocks in the South China Sea have forced fishing crews from Vietnam and elsewhere to sail deeper into disputed waters.
In July a Chinese naval vessel fired at a Vietnamese fishing boat near the Spratlys, sinking the boat and killing one sailor, reports said.