As a guerrilla commander about 40 years ago, Li Xiannian discovered how to resist Japanese invaders without squandering the strength that the Communists would need for the impending struggle against the Chinese Nationalists, then in power.

"Sit back and watch the tigers fight," he advised during the war in which Communist and Nationalist troops supposedly were allied against the foreign occupiers.

Li ordered his rag-tag outfit to snipe at Japanese camps, then had it quickly retreat to let Nationalist forces face the invading army.

The clever ploy not only won him a place in revolutionary lore, but it also became Li's strategy for negotiating the treacherous turns in Communist politics long after the Japanese and the Nationalists were driven off the mainland.

When Li was named China's president, or head of state, Saturday, it was a tribute to his ability to stay above the fray. No other Communist leader so easily moves among the querulous factions here.

In a nation of flamboyant, often relentless leaders, Li, 73, is the consummate survivor. He has remained at the party's ruling circle for almost 30 years, while his colleagues have fallen in two Maoist upheavals and two rightist comebacks.

Li, an uneducated carpenter before joining the Chinese Communist Party in 1927, has outlasted them all.

His formula for success includes the traditional ingredients for Chinese leadership: a revolutionary's aura, administrative expertise and a wide network of contacts in the party and in the Army.

But Li also displays discretionary qualities rare for his generation of guerrilla fighters. He holds strong orthodox views but knows when to compromise. He competes in policy issues, not political power contests. Above all, he watches which way the tide is turning.

According to a western analyst, "Li bends, he flexes, he knows when to stop. He's the kind of politician stronger men want on their team."

Two political events best measure the extent of Li's endurance.

When Mao Tse-tung was failing in health in June 1976, Li was among his acolytes, and he is the only one still in power. Three others are serving long prison terms for treason, two are in political exile and the last is too feeble to function politically.

The other event that shows Li's political endurance reportedly took place early this year when Deng Xiaoping, Mao's nemesis who now rules China, convened top officials to discuss the new office of state president.

Once again, Li was present. Surveying the group, Deng is said to have noted everyone's qualifications, stopping to focus on the survivor. "Li Xiannian inevitably will assume the post of state president," Deng said, according to Chinese sources.

A western diplomat attributed Li's success to his ability to represent the "center of gravity in Chinese politics."

But Li's political center is not devoid of principles. Li and his old-guard faction have pushed the Stalinist approach to economic development, opposing Deng's more consumer-oriented reforms.

Li is an outspoken critic of the United States, an early proponent of normalization talks with the Soviet Union and probably the primary architect of China's new strategic independence.

Even when Mao was riding high, Li initially criticized his impetuous development program known as the Great Leap Forward.

Yet, Li knows the limit of dissent when more powerful forces amass against him. In 30 years, he has mounted a rightist challenge to Mao's policies and a leftist challenge to Deng's--yet has recanted contritely in both cases.

"Li always leaves himself room to retreat," said a Chinese intellectual.

He has been no less expedient during China's frequent power struggles. He went along with Mao's Cultural Revolution once his own place was secure. But he supported Deng's rehabilitation when the revolution began to ebb in 1975. After Deng's return, Li backed efforts to purge Cultural Revolution radicals, then applied the brakes when the housecleaning was aimed at his old-guard allies.

To many diplomats, Li was a natural choice for China's first head of state since the Cultural Revolution. The post is largely ceremonial, giving him a platform for his conservative economic and foreign policy views.

But the office is unlikely to strengthen his influence in the Politburo or its elite standing committee where Deng and his reform faction set the nation's course.

"Li has always been second ranking and he's always been satisfied with it," said a foreign analyst. "That's why he survives."