The U.S. Geological Survey (USGS) said the quake struck some 39 kilometres (24.2 miles) west-southwest of Jiquilillo, Nicaragua, at a depth of 71 kilometres.
Jorge Melendez, director of civil protection in El Salvador said there were only scattered reports of minor damage.
“There is no major damage,” he said.
The epicentre was near to where the land borders of El Salvador, Honduras and Nicaragua are at their closest point, and some buildings in Honduras were also evacuated, authorities said.
Authorities in El Salvador had earlier measured the quake at a preliminary magnitude of 6.2.
(Production: Manuel Carrillo)