TOKYO - An earthquake with a preliminary magnitude of 5.4 rocked Japan's western prefecture of Wakayama near Osaka on Friday morning, but there was no threat of a tsunami, the weather agency said.