MEXICO CITY (Reuters) - A powerful explosion rocked the Mexico City headquarters of state-owned oil giant Pemex on Thursday, killing at least 25 people, injuring more than 100 and trapping others inside.

The mid-afternoon blast in a neighboring building shattered the lower floors of the downtown tower, throwing debris into the streets and sending frightened workers running outside.

A government official, speaking on condition of anonymity, said a preliminary line of investigation was that the blast came from a gas boiler that exploded in the adjacent Pemex building. But the cause was still being determined, the official added.

The explosion at the building complex, where thousands of Pemex employees worked, was the latest in a series of serious safety problems to hit Mexico's national oil monopoly.

Interior Minister Miguel Angel Osorio Chong said the blast killed at least 25 people, injured over 100, and that the number of casualties could rise.

Rescue workers were still searching for employees trapped inside the Pemex skyscraper on Thursday night. At least one person had been rescued alive, Osorio Chong said.

Mauricio Parra, a paramedic at the scene, said that as many as 100 people could be trapped at the offices of Pemex, a national institution that President Enrique Pena Nieto's administration has pledged to reform this year.

Police quickly cordoned off the building, and television images showed the explosion caused major damage to the ground floor and blew out windows on the lower floors of the tower.

"You could feel it all through the building," said Mario Guzman, a Pemex worker who was on the 10th floor of the building, which is more than 50 stories high.

First mistaking the blast for an earthquake, Guzman, who said he escaped after running down the stairs, feared the building would collapse on top of him and his colleagues, "and that we would end up like a sandwich."

Pemex said initially the tower was evacuated due to a problem with its electricity supply. It then said there had been an explosion, but did not say what caused it.

The Pemex blast occurred shortly before many workers were due to end their shifts at the complex.

The company said its business would not be affected by the incident and that it would continue to operate normally.

FORCE OF LAW

Earlier in the evening, Pena Nieto, who took office in December, went to the scene and said the explosion would be thoroughly investigated. He vowed to apply "the force of the law" if anyone was found to be responsible for it.

Mexican media reported that after the blast, security officials carried out a precautionary search of Congress for explosive devices, but found nothing.

Asked about this, Osorio Chong said normal security procedures were being followed, but added that "additional care" was being taken while the blast was being cleared up.

Helicopters buzzed around the building and lines of fire trucks sped to the entrance, while emergency workers ferried injured people through wreckage strewn on the street.

Search-and-rescue dogs were sent into the skyscraper, a Mexico City landmark that sports a distinctive "hat" on top.

Some families of people working in the tower were impatient for news about missing relatives.

Gloria Garcia, 53, herself a Pemex worker who was not in the building during the explosion, came to see if she could track down her son, who worked in one of the floors hit.

"I'm calling his phone and he's not answering," Garcia said, weeping as she called repeatedly on her phone. "Nobody knows anything. They won't let me through. I want to see my son whatever state he's in."

DEADLY ACCIDENTS

Pemex has experienced a number of deadly accidents in recent years and lesser safety problems have been a regular occurrence. In September, 30 people died after an explosion at a Pemex natural gas facility in northern Mexico.

More than 300 were killed when a Pemex natural gas plant on the outskirts of Mexico City exploded in 1984.

Eight years later, about 200 people were killed and 1,500 injured after a series of underground gas explosions in Guadalajara, Mexico's second biggest city. An official investigation found Pemex was partly to blame.

Alberto Islas, a security analyst at consultancy Risk Evaluation, said the explosion at the Pemex offices was another blot against the company's safety record.

"We've seen this time and again at Pemex. They don't have a well-integrated policy," Islas said, noting it would probably take several hours before investigators would be able to determine the cause of the explosion.

Pemex, a symbol of Mexican self-sufficiency since the oil industry was nationalized in 1938, has been held back by inefficiency and corruption and by the burden it shoulders of providing about a third of federal tax revenues.

Pena Nieto has pledged to open up the company to more private investment to improve its performance.