On June 14, 1989, I was in the Associated Press bureau in Beijing. I had just filed a story about the reopening of the U.S. Embassy in China's capital. As the sun streamed through the office's grubby windows, the phone rang.

"This is the police in charge of resident foreigners in China," a male voice on the other end announced. "Are you Pan Aiwen?" He was using my Chinese name.

"Yes," I replied.

"You are ordered to appear at our bureau immediately," he said. Click.

Three days later, I was on a plane bound for Hong Kong, expelled from China. Officially, I stood accused of stealing state secrets and violating martial law provisions. My actual offense: I'd written about Tiananmen Square.

Since April of that year, when demonstrations first erupted, I had spent many nights on the square. I had frequented the dorm rooms of student activists and had wandered throughout the city, trying to chronicle the unfolding events. On the night of June 3, I was on the western outskirts of the city when the People's Liberation Army opened fire on protesters there. By the early hours of June 4, I was in the center of the square with the remnants of the student movement as the army tightened its noose.

Twenty years after the crackdown, the most intriguing question to me isn't how many people died, or whether there were deaths on the square itself or just on the streets that led to it. It's this: How has the Communist Party managed to emerge from that experience stronger than ever?

In 1989, a chorus of Western voices predicted the party's collapse. "One foot in power and one foot on a banana peel," was how the late, great David Schweisberg of United Press International described the party's predicament. I, too, filed my share of sensationalist dispatches, intimating a coming collapse.

But the party has defied such predictions. And it has done so by taking a brilliant step: giving a lot of Chinese -- in the countryside, the cities, the media, the security services and the government -- a bigger stake in preserving the existing system.

It's easy to conclude that the double-digit economic growth that has persisted since the early 1990s is what has kept the communists in power. And yes, Deng Xiaoping's trip to Shenzhen in 1992 opened the door to the resumption of pro-market economic reforms and an export-led growth strategy. The results include huge trade surpluses, a massive capital influx and the creation of Deng's social contract with the Chinese people: You can get rich and I won't mess with you, or you can dabble in politics and I will.

But China's communists needed a lot more to stay on top of the heap. Instead of thwarting change, as it had in 1989, the party realized that it needed to lead it. "Keeping up with the times" has become its new motto -- in the rural backwaters and the megalopolises, too.

In the countryside, where the majority of the 1.3 billion Chinese live, the party has encouraged township and village enterprises, or TVEs -- basically small factories in rural areas -- that have absorbed millions of farmers and constituted a powerful engine of growth. TVEs have been a major force in China's urbanization. Nearly 200 million people have moved off the land and into cities over the past 20 years.

Such factories and other development projects have also created problems. Since the early 1990s, party bosses and developers have joined forces to roust millions of farmers off their land to build factories and development zones. This has led to huge protests. But the party has learned from Tiananmen. Instead of cracking down on all the malcontents, it jails only the peasant leaders. The rest, it buys off, giving them enough compensation to return to their ordinary lives.

Recognizing the vast gap between rich and poor, the party has also announced that peasants no longer have to pay taxes. This hasn't succeeded in closing the gap, but it has been well-received by China's farmers.

In the cities, the party has launched reforms that appeal to China's growing middle class. The most significant is a housing reform program that allows (and occasionally forces) people to buy their own homes. Apartment ownership in the cities has jumped from 17 percent of families to 80 percent over the past two decades, while the average living space per person has increased from about 80 square feet to almost 300. Anyone who has ever been to China has seen the fruits of the huge industry this reform has spawned. The cranes! The glass! The marble! In 1998, the home-decorating market was worth around $50 billion. This year it's expected to surpass $200 billion.

But more than money, housing reform has prompted major social changes. For one, it has created an ownership society. The marchers who flooded Tiananmen Square in 1989 had, in the words of Cui Jian, the balladeer of that generation, "nothing to their names." But today's Chinese urbanites own apartments, cars and Jacuzzis -- things they really don't want to lose.

"I have struggled to win my piece of the piece in China," said Tom Lee, a friend who was tossed out of the party following the June 4 crackdown, earned a PhD in the United States and then returned to China to start a software firm. "I want to protect it. I don't want a revolution anymore."

Housing reform has also contributed to individual freedom. It prompted a jump in the divorce rate by creating a rental market, which gave fed-up spouses someplace to go. (In the past, if you wanted to get divorced in China, you pretty much had to sleep on the couch.) It's allowed lovers to live together without getting married.

Personal freedom expanded in other ways, most noticeably in the cities. Old communist China controlled everything. You needed a certificate to marry, divorce, have kids, retire, travel within the country or abroad, move, change jobs. Now, when Chinese finish university, they find their own jobs. Want to travel abroad? Get married? Get divorced? Go ahead.

The party has also reformed in relation to the media and thought control. It has created a system of graduated censorship. University residential communities and upper middle-class gated communities can enjoy uncensored satellite television and generally unblocked Internet access. The rest of China has no such luck, but the media and the propaganda organs that serve them have also changed. Gone are the 13-part series on ball-bearing factories, the staple of the old communist media. China's new communist media is more People magazine than People's Daily.

The party has also let the Internet become a public square in which anti-party views may be aired -- not freely, but with enough regularity to provide a relief valve. The censors have also modified their media controls. When major incidents occur, such as last year's earthquake or the 2003 debacle with SARS, the censors generally ease political pressure by allowing several weeks of relatively free reporting before clamping down -- a significant change from the old days when certain topics were banned, period.

Much has been made in the West of how the party has wiped out the memory of Tiananmen Square, of how many young Chinese have no idea what June 4 means and of the bizarre umbrella-wielding plainclothes police officers who blocked Western TV cameras on the square last week. But the party has also softened its tone on the crackdown. It used to refer to it as "counterrevolutionary turmoil." Now the term is the "Tiananmen Incident." Although the leaders of the student movement remain in exile -- one of them, Wu'er Kaixi, was stopped last week in Macau as he attempted to return to China -- the party has allowed lesser participants to come back for business or to visit family. Journalists who covered the events have also been allowed to return. I eventually made it back, serving as The Post's bureau chief in Beijing from 1998 to 2003.

The party today also uses China's security services differently. It learned an important lesson from Tiananmen: Avoid bloodshed if you can, but at the same time make sure the people understand that the system can still strike back when facing a threat. The decade-long crackdown on the Falun Gong spiritual sect, which has left scores dead, and the spasmodic suppression of separatist movements in Tibet and Xinjiang, send the message: If you get out of line, there are still hard men waiting for you.

Finally, the party itself has changed. Tiananmen saved the party from collapse; it prompted the party to launch a far-reaching investigation into how some political parties succeeded in staying in power and why others failed. As a result of that study, it replaced thousands of party hacks with technocrats and college graduates. It opened its door to business owners who decades ago would have been jailed for walking "the capitalist road." The party now continually schools its cadres (most vice ministers have spent time in the West and many speak some English) and it has upped its requirements for admission. It has also begun to experiment with a measure of intraparty democracy to weed out corrupt or incompetent officials, and it has worked hard to minimize internal battles.

Of course, China and the Chinese Communist Party face a boatload of trouble. The country's demographics are terrible; it's the first country in the world projected to grow old before it gets rich. Its environment is toxic. And at a certain point, China's political system, which still restricts information, will jam up its economic juggernaut. More broadly, the party has yet to find something to stand for other than self-perpetuation. But in China, these feel like problems for another day.

After Western analysts realized that the party would not fall, they seized on another article of faith -- that free markets and trade would bring democracy to China. But that hasn't happened either. Today, 20 years after the party's biggest test, China's Communists have retained their hold on power and emerged triumphant -- and have done so very much on their own terms.