An 8-year-old girl, mauled by a lion that was on display at a flea market, underwent a second operation today for a cracked skull. Doctors said she faces years of follow-up treatment for brain damage.

Part of the brain of the girl, Roxanne Maria Hernandez, was exposed after she was attacked Saturday.

The lion has since been killed. Dr. Karen Kemper, a city veterinarian, said the 300-pound lion was underweight and undernourished.

The lion was being led through the Texas Flea Market on a chain by its owner, Gary Durkovitz of Houston, police Lieut. C. W. Driskell said. Mr. Durkovitz had operated a booth where shoppers could have their picture taken with exotic snakes and the lion.

''The lion knocked over an ornament and became excited,'' said Brian Mason, who said he saw the attack. ''The little girl walked by, and he knocked her down. He grabbed her and started dragging her across the floor.''

A security guard shot the animal, Lieut. Driskell said. ''That seemed to aggravate the lion, and it grabbed her by the head,'' he said. ''He then shot the lion again, and they still had trouble getting it to release the little girl.''

Roxanne suffered eight depressed skull fractures, ''several of them clearly from the fangs of a large animal,'' said Dr. Michael E. Miner, director of neurosurgery at the University of Texas Medical School. 'It's a Miracle'

Roxanne underwent more than six hours of surgery Saturday night at Hermann Hospital. She was in surgery again today for removal of dead and injured tissue.

''It's a miracle she's still alive,'' said Roxanne's father, Joel Hernandez.

Dr. Miner said Roxanne has been able to respond to her parents. Mr. Hernandez said his daughter nodded Sunday when he said to her, ''Do you know Daddy loves you?''

Mr. Hernandez said doctors have warned him that Roxanne will probably need follow-up treatments and operations for at least three years.

The police turned the case over to the Harris County District Attorney's office. Mr. Durkovitz, the lion's owner, could not be reached for comment today.

After the attack, Houston officials injected the lion with tranquilizers and taped its mouth so it could be taken away. However, the lion slashed the arm of Dr. Kemper, a veterinarian with Houston's Bureau of Animal Regulation and Care.

Dr. Kemper said a city ordinance requires that tigers, lions and wolves be kept at least 300 feet from the nearest habitation, including the owner's. ''You surely can't walk them through a shopping center on a chain,'' she said.