Panamanian authorities said at least two people had been injured in a village but gave no details. Sigifredo Perez, head of operations for Costa Rica's National Commission of Emergencies, said no major damage or injuries had been reported in his country.
The U.S. Geological Survey said the quake had a 6.1 preliminary magnitude and was centered seven kilometers (four miles) southeast of the town of Plaza de Caisan. The quake occurred at a depth of about 37 kilometers (22 miles).
Images posted on social media showed simple wooden homes that partially collapsed in rural areas, deep fissures in tightly packed beach sand and entire grocery store shelves that spilled containers of processed food and bottled beverages on the floor.
"I was in the supermarket and everything swayed," Carla Chavez said by phone from David, the capital of Panama's Chiriqui province near the quake's epicenter. "Merchandise fell on the floor. Everything happened so fast."
Panama's National Civil Protection Service said via Twitter that walls cracked at a hospital and two supermarkets in Changuinola in Bocas del Toro province.
Northern Panama is frequently hit by earthquakes. In 1991, a magnitude 7.4 quake killed 23 people and injured 500. A magnitude 6.7 tremor in 2003 killed two people and damaged hundreds of houses.