WASHINGTON - An earthquake with a magnitude of 5.9 hit Costa Rica on Friday, the US Geological Survey said.The quake was centered about 21 miles (33.7 km) west of the capital city of San Jose at a depth of 30 miles (48 km).