A magnitude 7.3 earthquake has struck off the coast of El Salvador, prompting an alert of a possible tsunami threatening the shores of the country, as well as Nicaragua and Honduras, the Pacific Tsunami Warning Centre has said.

The quake struck late on Monday, 67km west-southwest of Jiquilillo off the coast of El Salvador and Nicaragua with a depth of 40km, the US Geological Survey said.

The US Pacific Tsunami Warning Center issued a warning for coastal areas located within 300 kilometres of the epicentre. But minutes later it said it had lifted the warning.

"Any remaining threat should be evaluated by local authorities in impacted areas," the US agency said.

Electricity was cut off in parts of El Salvador and walls crumbled, but there were no reports of widespread damage.

El Salvador's emergency services urged people living near the cast to move inland after placing a tsunami alert in effect. Nonetheless, they said via their Twitter account that coastal areas appeared calm.

The tremor was felt in the Nicaraguan capital Managua and other cities, but no immediate injuries or damage were reported, officials said.

But Nicaraguan President Daniel Ortega declared a preventive state of alert along the coast because of possible aftershocks.

Seaside residents were urged to seek higher ground, and classes in schools were cancelled nationwide for Tuesday.

Electricity and cell phone service in some areas of Nicaragua were cut off.

A 5.3 magnitude aftershock was felt in Costa Rica.

Source: Agencies