Perez said more than 2,000 soldiers were deployed from a base in San Marcos to help with the disaster. A plane had already made two trips to carry relief teams to the area.
The president urged people to stay put as emergency crews try to reach victims on the few roads not blocked by landslides or debris. He also encouraged people in the affected areas to stay outside and away from tall buildings.
David de Leon, spokesman for civil protection, told radio station Emisoras Unidas that officials were working on evacuations and relief. There were five strong aftershocks by Wednesday night.
Perez said 150 people had been evacuated by air from the San Marcos area, where 91 inmates, including five women, were huddled to one side of the adobe makeshift jail that had floor-to-ceiling cracks and threatened to collapse. Police told the prisoners they were to be moved.
"We'd rather stay here and reconstruct the jail than be displaced. That will be hard for our families," said inmate Benjamin Tomas Gomez.
The country's minister of communications and infrastructure told Emisoras Unidas that landslides had blocked several highways in the west of the country, and it would take at least 24 hours to re-establish transport links to San Marcos.
A spokesman for El Salvador's Red Cross branch told The Associated Press that the quake had been felt throughout the country, sending people fleeing their homes in the capital, but there had been no immediate reports of injuries or serious damage.
The mayor of Mexico City said no serious damage or injuries were reported in the city, although many people fled their offices and homes during the quake.
Associated Press writer Sonia Perez-Diaz reported this story in San Marcos and Romina Ruiz-Goiriena reported from Guatemala City.
Copyright 2012 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.