There were no immediate reports of deaths of injuries Sunday night after a strong earthquake shook Costa Rica.

The temblor, with a preliminary magnitude of 6.5, knocked items from store shelves and sent people rushing out of buildings in panic.

Four minutes after the initial earthquake, a magnitude 5.2 aftershock struck.

President Luis Guillermo Solis said via Twitter that the government was still gathering information. He urged people to remain calm and prepare for aftershocks.

The U.S. Geological Survey said the quake was centered along Costa Rica's Pacific Coast, about 10 miles southeast of Jaco, which is about 60 miles southwest of the capital of San Jose.

The quake was at a depth of about 12 miles.

The country's Public Safety Ministry said there were reports of two serious injuries as a result of the quake, but did not provide additional details.

Electricity was knocked out in some areas as power lines and poles fell, but there were no reports of major infrastructure damage from the temblor, which hit in a lightly populated area on the Pacific Coast. The government reported some rockslides obstructing highways near the epicenter.

The U.S. National Weather Service said there was no Pacific-wide tsunami threat, Reuters reported.

Matt Hogan was at home in Punta Uvita, about a 90-minute drive down the coast from the epicenter when the quake hit around 8:30 p.m. Sunday. He said the shaking whipped up two-foot waves in his swimming pool and knocked over glasses and containers in his kitchen.

The quake was initially measured as high as magnitude 6.8, Reuters reported.

Magdalena Lopez, who lives in Jaco, said the tremor started softly, but quickly strengthened.

"When we were trying to get out of the house it started to shake again very strongly," she said. "All of our neighbors were in the street. In front of my house there is an overlook some people started to go up, but it quickly started to shake again."

The Associated Press contributed to this story.