The City Council voted overwhelmingly today to ban the sale of all leaded gasoline here within 90 days, making Chicago the first U.S. city in more than a decade to take such a step.

Many health experts say the toxic lead in gasoline poses a threat of mental retardation and other serious health problems for urban children.

Before it can take effect, the new law must survive a likely legal challenge from gas station operators, and the state of Illinois must approve a package of long-planned air cleanup measures that would incorporate the City Council's action.

"I'm mad as hell about this," said Robert Jacobs, executive director of the Illinois Gasoline Dealers Association. He said he had directed the group's lawyers to file suit in federal court to overturn the law. A similar ban enacted in New York City in 1971 was struck down by the courts there.

The council's 36-to-7 vote in favor of the ban brought smiles of satisfaction from a coalition of local environmentalists in attendance. They had lobbied for months among the aldermen to overcome the racial animosities that have divided the council for more than a year on most major issues.

The new law would prohibit the estimated 2,200 gasoline dealers in the city from selling leaded gasoline. Leaded gas accounts for about 30 percent of all gasoline sold in the city, according to industry figures. While most U.S. vehicles built since the mid-1970s function best with unleaded gasoline, many motorists use leaded gas, which is about 7 cents a gallon cheaper.

A recent Environmental Protection Agency study found that one of every five Chicago cars with an emissions-reducing catalytic converter, which requires the use of unleaded gas, had been tampered with to allow the use of leaded gas. This raises levels of carbon monoxide and ozone pollution, as well as lead.

The addition of lead is an inexpensive way to increase the octane in gas, improving engine performance. Lead is discharged into the atmosphere as exhaust, and much of it accumulates on the ground near streets and highways. Lead ingested by humans concentrates in teeth and bones. The EPA, alarmed by rising atmospheric concentrations of lead, has proposed reducing the amount in gasoline by 91 percent by 1986 and banning it completely by 1995.

The council's action comes two days after Mayor Harold Washington banned the purchase or use of leaded gasoline for city vehicles. In a prepared statement, Washington today commended the council "for taking this important step to protect the health of Chicagoans, especially our children."

"Eventually, I think we'll see a nationwide sweep here," said Alderman Joseph Kotlarz, a sponsor of the measure. He said Harvard Medical School statistics indicate that 675,000 American children suffer from lead poisoning.

Another sponsor, Alderman Danny K. Davis, said that "18.6 percent of all urban black children have unhealthy lead levels," and he put most of the blame on leaded gas.

Kotlarz said today that "this initiative served as a model for the nation." The coordinator of the environmental coalition, Marilyn Katz, said Chicago's action "should spur other cities into action and spur the EPA after 10 years of foot-dragging."

Chicago was also one of the first U.S. cities to ban phosphates in detergents, a step credited with helping reduce pollution in the Great Lakes.