SAN SALVADOR: A Pacific Ocean earthquake with a 7.2 magnitude shook El Salvador and Nicaragua on Thursday, officials said, an hour after a powerful hurricane hit Nicaragua's Caribbean coast.

Salvadoran authorities issued a tsunami alert as a precaution.

The temblor occurred around 120 kilometers (75 miles) off the coast of El Salvador, at a depth of 33 kilometers (20 miles), according to the US Geological Survey, confirming the magnitude given by Salvadoran officials.

Shaking was also felt in the Nicaraguan capital of Managua, and as far as the Costa Rican capital San Jose. There were no immediate reports of damage or casualties.

Just one hour earlier, a powerful hurricane, Otto, packing winds of 175 kilometers (110 miles) per hour made landfall on Nicaragua's other coast. The heavy rains it was offloading were likely to cause dangerous flooding and mud slides, according to the US National Hurricane Center.

Earlier on Thursday, category 2 Hurricane Otto hit land near the southeastern coast of Nicaragua, where thousands had already been evacuated away from vulnerable coastal areas and into shelters.

Hurricane Otto, a rare late-season storm hitting further south than usual, is expected to churn slowly along the border of the two countries into Friday, wreaking destruction as it gradually loses strength.

The hurricane came ashore near San Juan de Nicaragua, also known as Greytown, south of the city of Bluefields and close to the Costa Rican border, Walter Fonseca, the operations chief for Costa Rica's National Emergencies Commission told Teletica television.

Its position, strength and trajectory are also being monitored by the US National Hurricane Center, which warned Otto's trailing rains "will likely result in life-threatening flash floods and mudslides."

As it massed offshore earlier this week, its outer bands of wind and rain caused four deaths in Panama.

Thousands of people in at-risk communities along the Nicaraguan and Costa Rican coasts were evacuated ahead of the hurricane.

In Bluefields, a city of 45,000 people, and elsewhere, panic-buying cleared shops of bottled water, battery-powered lamps and plastic bags. On Wednesday, hundreds crammed onto boats to flee, while others remaining hammered metal sheeting over windows.

"This is the first time a hurricane has hit here," said Faucia Pena, an inhabitant of Bluefields. "We are asking God to end it or send it elsewhere. Everybody is afraid."

Some Nicaraguans further south had crossed the nearby border into Costa Rica, hoping it would be safer there, according to locals.

Both Nicaragua and Costa Rica have closed schools, mobilized emergency crews and issued red alerts for areas across much of their territories.

Costa Rica has declared a nationwide emergency, sending non-essential public workers home for Thursday and Friday and urging private companies to do likewise.

"Let me be clear: the hurricane is potentially highly destructive," Costa Rican President Luis Guilermo Solis warned in a broadcast late Wednesday.

Costa Rican officials met early Thursday to evaluate preparations.

"We are doing everything necessary," Solis said, adding that there were no shortages of fuel or water reported.

Despite the evacuation order in parts of Costa Rica, some residents defiantly opted to stay.

"Some people don't want to leave their homes, leave all their possessions, their animals," police officer Christian Rodriguez told the Costa Rican newspaper La Nacion in the village of Batan, close to Limon.

One woman who did evacuate her home near the village of Barra del Colorado, Teresa Romero, 52, told AFP that around 10 male locals had refused to leave. She was taking shelter in a church near the capital San Jose.

The high winds and heavy rains could devastate crops - a big blow especially in Nicaragua, one of the poorest countries in Latin America.

Otto "could seriously jeopardize food security for small farmers who rely on maize (corn), beans, cocoa, honey, coffee and livestock for their livelihoods" in Nicaragua, Jennifer Zapata, a regional director for Heifer International, a US-based poverty-fighting charity, said in a statement.

Otto is a rare, late-appearing hurricane in the Atlantic storm season, which runs from June to the end of November.

It is also on an unusually southern trajectory.

"Otto is the southernmost landfalling hurricane in Central America on record," the US hurricane center said.

A previous, far-stronger hurricane, Matthew, devastated parts of southern Haiti early last month, killing 546 people and leaving nearly 175,000 homeless.