An earthquake with a magnitude of 5.4 hit Wakayama Prefecture in southwestern Japan on Tuesday. The quake was also felt in Osaka, Xinhua reported.