The U.S. Geological Survey reported the quake had a preliminary magnitude of 6.6. Its epicenter was about 17 miles (28 kilometers) south-southeast of La Libertad, a suburb of the regional capital, Santa Tecla, and it was recorded at a depth of 65 kilometers (40 miles).
The Pacific Tsunami Warning Center did not issue an alert for the quake but the Salvadoran environment ministry issued its own tsunami warning, predicting sea level variations of up to 12 inches.
Coastal residents should avoid entering the water for four hours after the quake, the ministry said on Twitter.
The earthquake was felt strongly in the capital, San Salvador. People left their homes with flashlights, and power was knocked out in at least some areas.
There were no initial reports of casualties or major damage, Salvadoran authorities said.
More about: earthquake