China announced tonight it is ending its 17-day-old invasion of Vietnam and withdrawing "all Chinese frontier troops... to Chinese territory."

There was no immediate reaction to the announcement from Hanoi, but an official Vietnamese radio broadcast, more than three hours after the Chinese announcement, said Vietnam had ordered a "general country-wide mobilization." The broadcast did not say when the decision was made.

As Peking's offivial New China News Agency made the withdrawal announcement, Vietnam's offivial news agency said the war was "expanding" with Chinese reserves coming into action. Western analysts said a Vietnamese decision to attack Chinese troops while they withdrew could lead to Chinese retaliation and seriously prolong the war.

[Hanoi authorities "recommended" that foreign embassies in the capital evacuate nonessential staff and dependents, Agence France-Presse reported from Hanoi, quoting unnamed official sources. The Japanese Embassy in Hanoi said Vietnamese officials had instructed it to prepare air raid shelters, Japan's Kyodo news service reported.]

In Washington, State Department officials said U.S. Ambassador Leonard Woodcock and other envoys in Peking were called in by Chinese officials to be told of the withdrawl. State Department officials said, however, that the United States had no independent confirmation that withdrawal had begun.

Peking's withdrawal announcement followed what analysts here called an important Chinese victory in capturing the Vietnamese provincial capital of Lang Son, 12 miles inside Vietnam, along with other military successes along the 500-mile front.

"They beat the hell out of the Vietnamese," said one analyst here, describing the battle of opposing armored vehicles, artillery and infantry around Lang Son. "The Vietnamese know that; the Russians know that. That is all the Chinese are interested in."

Some Bangkok analysts suggested that Hanoi was at least successful in reducing its potential losses by refusing to commit main-force units stationed near Hanoi.

Analysts here said some Chinese units in areas not hotly contested by the Vietnamese appear to have already begun withdrawing in the last few days.

Peking has an estimated 85,000 to 100,000 troops in Vietnamese territory. None are said to be deeper than 25 miles inside the country. The Chinese announcement did not say how long the withdrawal would take, but one analyst said a retreat in careful stages to defend against possible Vietnamese attacks could take a week or more.

Vietnamese Vice Foreign Minister Hoang Bich Son, asked his reaction today while attending a conference in Manila, said, "From our experience with China, they say one thing and they do another. They say they are withdrawing their troops. It means they are preparing for the intensification of the war. We don't believe what they say."

The Chinese attacked Vietnam on Feb. 17. Peking said it wanted to punish Hanoi for years of border violations, involoving destruction of property and killing of Chinese citizens.

Foreign analyst suggested, however, that Peking was more interested in convincing the Soviet Union, Vietnam's ally and China's foe, of Chinese will to fight and taking some pressure off pro-Peking insurgents fighting Vietnamese troops in Cambodia. China promised form the start that the invasion would be limited in time and scope, apparently to soften adverse world reaction and prevent direct Soviet intervention.

"The Chinese frontier troops have attained the goals set for them since they were compelled to launch a counterattack in self-defense on Feb. 17 against ceaseless armed provocations and incursions of the Vietnamese aggressors against Chian," said the Chinese news agency in a statement "authorized by the Chinese government."

"We warn the Vietnamese authorities that they must make no more armed provocations and incursions along the Chinese border after the withdrawal of the Chinese frontier troops," the statement said. "The Chinese government solemnly states that the Chinese side reserves the right to strike back again in self-defense in case of a recurrence of such Vietnamese activities."

The announcement repeated Peking's earlier calls for negotiations with Hanoi to ensure "peace and tranquility along the border." Hanoi has said in the past it will not negotiate with Peking while Chinese troops are on Vietnamese soil.

Peking did not clarify tonight previous hints in its official press that it might continue to occupy a few small portions of formerly Vietnamese-held territory that it considers part of China. One Japanese report put the disputed areas at only 38 square miles, but continued Chinese occupation of such areas could increase the likelihood of more Vietnamese border attacks leading to renewed war.

"The Chinese government reiterates that we do not want a single inch of Vietnamese territory," the Peking announcement said. "But neither will we tolerate incursions into Chinese territory. All we want is a peaceful and stable border."

There have been rumors of an impending Chinese withdrawal for several days in Peking, all of them quickly disputed by Hanoi spokesmen. Vietnam's Communist Party newspaper, Nhan Dan, published an editorial today entitled: "The whole of Vietnam is fighting, each Vietnamese is a fighter."

A Vietnam News Agency story tonight, quoting the editorial, added, "The reactionaries on China are trying to make the public believe in an imminent withdrawal of Chinese troops and are readying their reserves. Already deployed are seven Army corps and many unattached divisions, and an important part of the Chinese Air Force has also been mobilized. More than five Chinese Army corps ar invading Vietnamese provinces in the norhtern border. A major war, started in Feb. 17, is expanding."

Vietnam's news agency paid tribute yesterday to the Trung sisters, who led a revolt against Chinese occupying forces 1,939 years ago."Following the example of the two Trung sisters, our people and armed forces are now determined to completely defeat the Chinese aggressors," the agency quoted a local official as saying.

Analysts said tonight that the belligerent Vietnamese language could indicate a desire to counterattack, or simply an attempt to mount a propaganda campaign that would end in a declaration of Vietnamese victory as the Chinese leave the country. One analyst said that if the Vietnamese did rush to attack the departing Chinese troops, "the fighting we have ahead of us may be even heavier than the fighting we had behind us."

The terrain in the Vietnamese border area is hilly and mountainous, with many hillsides and caverns that facilitate ambushes and guerrilla warfare.

"It's as difficult to retreat in that country as it is to advance," one analyst said.

The official Vietnam News Agency said today that Chinese troops had suffered about 44,000 casualties through yesterday, a figure Western analysts consider greatly inflated. Peking has not officially disclosed its casualties or Vietnam's. Hanoi has not reported its own losses.

Vietnam claimed today that the Chinese LOST 381 MILITARY VEHICLES, INCLUDING 259 TANKS AND ARMORED CARS AND 66 ARTILLERY PIECES AND HEAVY MORTARS IN the first two weeks of the war.

China's announcement said nothing about plans for an exchange of prisoners. A Chinese source in Hong Kong has claimed thousands of Vietnamese has claimed thousands of Vietnamese have been captured, and a special Chinese satellite television broadcast today showed men described as prisoners of war.

In the 1962 Chinese-Indian border war, which some Chinese officials have described as a model for this conflict, the Chinese announced a unilateral cease-fire about a month after beginning their invasion and then withdrew to their own border. Indian prisoners were returned after that.

Although acknowledging that Vietnam never sent its main-force divisions stationed near Hanoi into the war, one analyst said the Vietnamese in the regional forces fighting the Chinese were often combat veterans and there were some main-force units from other parts of the country involved.

Particularly at Lang Son, the analyst said, the Vietnamese appeared to make a determined, and unsuccessful, effort to stop the Chinese advance.

"The fight for Lang Son went on for well over a week. The Vietnamese were heavily entrenched, with large reinforcements sent in by both sides -- infantry, armor and artillery on both sides. Hanoi never ordered anybody to withdraw, but the Vietnamese were just pushed out of there," the analyst said.

Heavy Vietnamese resistance near Lao Cai in the west and Cao Bang in the middle of the front also resulted in Vietnamese defeats, the analyst said. The Chinese also captured the far northeastern provincial capital, Mong Cai, analysts said.

The battle for Lang Son occurred mostly on the hills around the city, with opposing units battling for high ground that protected troops and artillery units.

A Japanese correspondent today published an Eyewitness account in Asahi Shimbun on the fighting Saturday. He said while troops moved over the hills, smoke poured from the center of the town below.

The 40,000 civilian residents had mostly been evacuated, he said.

The correspondent, Kazuhisa Ikawa, said he saw flattened houses and a burning bridge spanning a river that flows through the city. When 133mm shells began to hit near him and Chinese troops appeared to be advancing on the hill from which he watched the scene, the correspondent said, he headed south. He found thousands of refugees on the road, he said.

The Chinese withdrawal announcement followed charges from both Moscow and Hanoi that China was preparing to extend the war to neighboring Laos.

There had been some reports of Chinese supplying arms to anticommunist Meo tribesmen in Laos, a Vietnamese ally. Some Chinese military movements in the Vietnamese border areas near the Laotian border were noticed by analysts, but most said they doubted the Chinese ever intended to invade Laos.

Some analysts suggested that the Cninese had failed in one objective because Vietnam appeared not to have withdrawn any significant number of troops from Cambodia, where it has installed a pro-Hanoi government and is fighting pro-Peking guerrillas.

The Chinese announcement said, "We hope that all countries and people that love peace and uphold justice will take measures to urge the Vietnamese authorities to stop promptly their aggression against Kampuchea [Cambodia] and withdraw all their forces of invasion back to their own territory."