Costa Rica President Laura Chinchilla announced there were no reports of major damage and called for calm.
At the epicenter, the beach town of Cangrejal, Jairo Zuniga, 27, said everything in his house fell when the quake hit at 8:42 a.m. (10:42 a.m. EDT; 1442 GMT).
"It was incredibly strong. I've felt earthquakes, but this one was `wow,' he said.
The U.S. Geological Survey said the quake was centered about 38 miles (60 kilometers) from the town of Liberia and 87 miles (140 kilometers) west of the capital, San Jose, where frightened people ran into the streets.
The magnitude initially was estimated at 7.9, but was quickly downgraded. Local residents said it shook for about 30 seconds and was felt as far away as neighboring Panama and Nicaragua, where school was canceled in some areas.
Officials initially warned of a possible tsunami, and local police supervisor Jose Angel Gomez said about 5,000 people -- 80 percent of the population -- had been evacuated from coastal towns in the Samara district west of the quake's epicenter. But by mid-day they were allowed to return.
Panama also briefly called for people to evacuate beach areas.
In Costa Rica, one man died of a heart attack caused by fright, said Carlos Miranda, a Red Cross worker in the city of Liberia.
Douglas Salgado, a geographer with Costa Rica's National Commission of Risk Prevention and Emergency Attention, said officials a landslide hit the main highway that connects the capital of San Jose to the Pacific coast city of Puntarenas, and hotels and other structures suffered cracks in walls and saw items knocked off shelves.
Rosa Pichardo, 45, who lives in Samara, was walking on the beach with her family when the quake hit.
"When we felt the earthquake, we held onto each other because we kept falling," Pichardo said. "I've never felt anything like this. We just couldn't stay standing. My feet gave out under me. It was terrible, terrible."
In the town of Hojancha a few miles (kilometers) from the epicenter, city official Kenia Campos said the quake knocked down some houses and landslides blocked several roads.
"So far, we don't have victims," she said. "People were really scared ... We have had moderate quakes but an earthquake (this strong) hadn't happened in more than 50 years."
Michelle Landwer, owner of the Belvedere Hotel in Samara, north of the epicenter, said she was having breakfast with about 10 people when the earthquake struck.
"The whole building was moving, I couldn't even walk," Landwer said. "Here in my building there was no real damage. Everything was falling, like glasses and everything."
In the coastal town of Nosara, roughly 20 miles (30 kilometers) southwest of the epicenter, trees shook violently and light posts swayed. Teachers chased primary school students outside as the quake hit. Roads cracked and power lines fell to the ground.
Wednesday's quake occurred in a seismically active zone where the Cocos tectonic plate is diving beneath the Caribbean plate.
"All along the Pacific coast of Central America, you can expect fairly big earthquakes," said seismologist Daniel McNamara of the U.S. Geological Survey.
The quake was somewhat deep -- 25 miles (41 kilometers) below the surface. Quakes that occur deeper underground tend to be less damaging, but more widely felt.
"If it was a shallower event, it would be a significantly higher hazard," he said.
In the last four decades, the region was rocked by 30 earthquakes magnitude-6 and larger. Two were larger than magnitude-7 -- in 1978 and 1990 -- but did not cause any deaths.
The last deadly quake to strike Costa Rica was in 2009, when 40 died in a magnitude-6.1 temblor. The last similar-sized quake to hit the country was in 1991 when 47 people were killed in the Limon-Pandora area.