Vietnam formally accused China of violating its sovereignty and a recent confidence-building pact on Saturday by landing a plane on an airstrip Beijing has built in a contested part of the South China Sea.

Vietnamese Foreign Ministry spokesman Le Hai Binh said China had conducted a test-flight to the airfield, "built illegally on Fiery Cross Reef, which is part of Vietnam's Spratlys".

In a statement, he called it "a serious infringement of the sovereignty of Vietnam on the Spratly archipelago, contrary to the common perception of high-ranking leaders of the two countries and (to) an agreement on the basic principles for directly solving maritime issues between Vietnam and China".

Vietnam handed a protest note to China's embassy and asked China not to repeat the action, Binh said.

The two Communist-led states' competing claims in the South China Sea came to a head in 2014 when Beijing parked an oil rig off the Vietnamese coast, leading to anti-China riots.

Late last year, China completed an airfield on Fiery Cross Reef that security experts say could accommodate most Chinese military aircraft.

Chinese President Xi Jinping visited Hanoi in November, at a time of uncertainty over what kind of leader will emerge from this month's five-yearly congress of the Vietnamese Communist party, traditionally close to Beijing but now getting intense Western attention, from the United States in particular.

Both sides agreed during Xi's visit to maintain peace in the sea and build a relationship of trust.

China claims almost all the South China Sea, which is believed to have huge deposits of oil and gas, and through which about $5 trillion in ship-borne trade passes every year, and has been building up military facilities on the islands it controls.

Besides Vietnam and China, Brunei, Malaysia, the Philippines and Taiwan also have claims in the South China Sea.