More than 4 million motor vehicles are registered in Sao Paulo. Ricardo Teixeira is sitting in one of them, and worrying about the rest.

Under a gray sky, on a six-lane highway beside the polluted Rio Tiete, Teixeira is stuck in traffic. If this turns out to be an average day, traffic on more than 60 miles of Sao Paulo roads will be paralyzed at some point during the morning and evening rush hours. Six people will die in accidents.There will be little for Teixeira and his fellow traffic engineers to do except remove the odd stalled vehicle and keep track of the statistics. In the world's third-largest city, the key to rush-hour traffic management is a corps of 14 men standing on top of tall buildings with binoculars and walkie-talkies.

"All my gray hairs come from these roads," says Teixeira, who is responsible for two riverside stretches that handle more than 800,000 cars a day. "I'm not sure how much more I can take."

How much more can Sao Paulo take? Growth in the metropolis of 16 million has been so rapid and so disorganized that moving around has become a formidable challenge. The city is struggling against growing odds to keep its environment from being irreversibly fouled. Social problems, ranging from unemployment to crack cocaine, are getting worse.

Traditionally, Sao Paulo has been regarded as rich and resourceful. It's a Brazil without beaches or jungles or a carnival worthy of the name, a gray and gritty Brazil that works hard and keeps its promises.

They call it a locomotive, pulling the rest of the country along behind. But the engine has been stoked so long and so hard that it threatens to blow apart.

Teixeira and the rest of the people trying to run the place are struggling not only against unplanned, uncontrolled growth and an unruly private sector, but also state and national governments whose policies effectively put many solutions beyond the city's reach.

In Brazil, as in many parts of Latin America, there's tremendous ferment at the local level. Cities won greater autonomy in the transition from military dictatorships to civilian democracy, and local governments and citizen groups are tackling long-standing urban ills. But autonomy isn't the same as the capacity to get things done.

Local authorities in Latin America cannot issue bonds or borrow money for public works without the approval of senior governments. Municipal politics is hobbled by rules barring the re-election of mayors. And although three-quarters of the region's people now live in urban areas, national governments commonly adopt economic policies without considering the consequences for cities and their environments.

Sao Paulo's traffic rapidly got worse in 1994 after a national economic plan known as the "Plano Real" swiftly increased the buying power of the national currency. Gasoline and cars became cheaper; the number of automobiles sold each year in Brazil has nearly doubled since 1992.

Would a subway line help? Certainly. In fact, there is one. It's clean, efficient, but short - just 26 miles long in an 3,200-square-mile metropolitan area. Only the Sao Paulo state government can extend the subway - and it lacks the money.

The same state government is responsible for the Rio Tiete, into which the city's sewage is dumped - four-fifths of it untreated.

To be sure, some of Sao Paulo's difficulties flow from its own success. As with other mega-cities, new investment shuns the central core and all its problems, choosing instead the metropolitan fringe or the smaller, increasingly prosperous cities that lie 60 or 120 miles away.

The resulting shrinkage in economic activity and the tax base appears to be exacerbated by the current phase of the economic plan, which has Brazil sliding slowly into recession.

The national statistical agency registered a 6-percent drop in industrial activity in Sao Paulo in the 12 months ending in March. A labor-sponsored research institute recently put the metropolitan unemployment rate at just under 16 percent, the highest since 1992.

Urban experts fear further dislocation is on the horizon, as Brazil continues to lower trade barriers and embrace the global economy.

"We need a new design for municipalities," said Paul Singer, an economist at the University of Sao Paulo and former municipal secretary of planning. "We can't depend any more on the whims of the financial markets and globalization."

A century and a half ago, Sao Paulo was a quiet mission town surrounded by coffee plantations. In the 1950s it was a Toronto-sized metropolis. Since 1960, it has spread from its congested center outward. While population growth has stalled at 10 million in the city, Greater Sao Paulo - now at 16 million - is still growing by 1 to 2 percent a year.

The city has given new hope to millions of migrants from the famished backlands of northeastern Brazil. It has spawned a clutch of satellite cities, housing auto plants and foundries. Despite its current woes, Sao Paulo state still accounts for nearly half the country's industrial activity - although that's down from close to 60 percent in 1970.

"If you took Sao Paulo out of Brazil," observed national government economic adviser Roberto Melo, "it would be one of the richest countries in the world."

You see what he means along the broad Avenida Paulista, amid the bank towers and swank shopping arcades. Or in the flashy restaurants and radiant boutiques of the Jardins neighborhood. Or the suburb of Morumbi, where, according to the newsmagazine Veja, a banker named Joseph Safra is building a $14-million mansion with 130 rooms, nine elevators and a facade modeled on the Palace of Versailles.

But remember, this is Brazil, global champion of unequal development. Across town from Morumbi is the "favela," or squatter settlement, known as Heliopolis, where Jose Oliveira and his wife Maria do Socorro live in a warren of wooden shacks alongside a ditch full of sewage and detritus.

Barring an early apocalypse, Safra's house is unlikely to suffer the same fate as the one owned by the Oliveiras. Three times, rainstorms have washed their one-room dwelling into the ditch. Three times they've rebuilt it, most recently digging a channel to carry the runoff away.

So how is Heliopolis, compared with their home state of Paraiba in the northeast?

"Here it's easier to live," Oliveira said, which tells you something about Paraiba. In a good week he makes $60 delivering groceries for shoppers at a nearby market, and his wife finds work cleaning nearby houses. (Sao Paulo prices are comparable to New York's.)

The couple would like something a little more stable in the way of housing than their home in Heliopolis, which, with 70,000 people, is Sao Paulo's largest favela.

"If I went somewhere else, what would I do?" Ms. Oliveira asked. "I wouldn't know anyone."

As rapid as the city's overall expansion is, it's dwarfed by the growth in the favela population.

Here's something that local governments could have done something about, yet until recently the squatters were all but ignored. A recent study found 1.9 million people - one of every five Paulistanos - living illegally on the margins of richer neighborhoods, without title to their land, usually with running water and electricity but no sewage hookup. (In 1973 the figure was one out of every 100.)

There are also 600,000 living illegally in rundown tenements called "corticos," and hundreds of thousands more in illegal subdivisions.

Far from universal misery, the study found a wide range of housing in favelas - everything from shacks like the Oliveiras' to well-built brick or concrete houses with two or three floors and satellite-TV dishes on the roof.

"Some people in favelas now have quite reasonable living conditions," said study coordinator Silvia Maria Schor, an economics professor at the University of Sao Paulo.

She also found that unemployed city dwellers have been leaving expensive rental apartments and buying favela houses instead. The city's housing department says favela income levels are rising, too, with nearly half the families earning more than four times the minimum wage.

At the same time, new favelas - and some legal subdivisions - are being built in places that pose a high risk to the physical environment.

Nearly one-third of the city's water supply comes from two reservoirs on its southern fringe. The area between them is rapidly filling up with shanties, whose sewage runs directly into the water supply.

"Land use in Sao Paulo has been quite chaotic, with very rapid growth spreading continuously into areas where the soil is unsuitable and highly prone to serious erosion," said a report by the United Nations department for economic and social developent.

This is provoking a fervent debate among favela residents, urban experts and politicians. Anyone familiar with urban-renewal battles in the industrial world will recognize it immediately: Do you tear up rundown old housing and build apartments, or try to make the existing favelas more livable?

Besides feeling sandbagged by national policies, local officials acknowledge that their relationship with the private sector isn't always what it should be. Some developers, they say, don't even talk to the government about their plans.

Sanderley Fiusa, a veteran urban planner who is coordinating the favela project near the reservoirs, cites a billion-dollar project in the Morumbi district that he says was built without consultation with the local government.

"They don't tell City Hall, and then they come and say there are no services there. Meanwhile, in the center of the city, you have everything. But private business doesn't want to locate there."

(Distributed by Scripps Howard News Service.)