An earthquake with a magnitude of 5. 2 occurred off the coast of Miyazaki Prefecture in southwestern Japan, prompting warnings of potential aftershocks, but no tsunami threat.