A magnitude 5 earthquake hit the Greek coast 34 km (21 miles) south southwest of Kalamata on Wednesday, the U.S. Geological Survey said.