By Ivan Castro

BLUEFIELDS, Nicaragua (Reuters) - Tropical storm Otto moved out to sea on Friday after battering Nicaragua and Costa Rica with hurricane-force winds and torrential rains, killing at least three people and forcing thousands to evacuate.

Otto landed as a hurricane but weakened rapidly after hitting the southeastern coast of Nicaragua and became a tropical storm by early Friday, the U.S. National Hurricane Center said, as dangerous flooding thrashed both countries.

In Costa Rica, President Luis Guillermo Solis said on Twitter that at least 3 people had died and some 2,500 people had been evacuated. He said rescue efforts continued.

Otto, the seventh Atlantic hurricane of the season, landed north of the town of San Juan de Nicaragua as a Category 2 storm on the five-rating Saffir-Simpson scale of intensity, the Miami-based hurricane center said.

By Friday morning the storm was heading out to the Pacific Ocean with top sustained winds of 60 mph (95 kph) and located about 115 miles (190 km) west southwest of Santa Elena, Costa Rica.

Soon after the storm had landed on Thursday, a 7.0 magnitude quake struck 93 miles (149 km) southwest of Puerto Triunfo, El Salvador, at a depth of 6.4 miles (10.3 km), the U.S. Geological Survey said.

There were no reports of major damage from the quake, but local emergency services ordered the coastal population to withdraw up to 0.6 mile (1 km) from the shore.

Nicaraguan President Daniel Ortega declared a state of emergency because of the storm and the quake, said spokeswoman Rosario Murillo, who is also his wife.

Nicaraguan civil protection officials said the hurricane, which was moving west at 14 mph ( 22 kph), damaged homes and telephone lines but had not claimed any victims as of early Friday morning.

'WE DON'T WANT TO DIE'

In Bluefields, a city in Nicaragua's southeastern Mosquito Coast, rainfall began early in the morning. Hundreds had moved to storm shelters by Thursday evening.

"We left because we don't want to die. We love our lives," said 53-year-old Carmen Alvarado, who was hunkering down in a school in Bluefields. She was among the 206 people evacuated from the coastal community of El Bluff.

"The fear there is that we were surrounded by water," said Senelia Aragon, 42, standing next to Alvarado, preparing a breakfast of flour tortillas with beans.

Bluefields, once an infamous pirate haunt, was smashed by Hurricane Joan in 1988, a devastating Category 4 storm that destroyed many of the town's 19th century wooden houses.

On the Corn Islands, which face Bluefields and are popular with tourists, 1,400 people were evacuated to shelters, emergency services officials said. Another 1,000 people more moved from Punta Gorda, which lies south along the coast from Bluefields.

Government officials said people along the country's southeast coast had refused to evacuate but declined to say how many.

The storm dumped about 6 inches to 12 inches (15 to 30 cm) of rain, with isolated amounts of 15 inches to 20 inches (38 to 50 cm).

(Writing by Gabriel Stargardter, Natalie Schachar and Dave Graham, Additional reporting by George Rodriguez in San Jose; Editing by Tom Heneghan and Jeffrey Benkoe)