An earthquake with a preliminary magnitude of 4.5 briefly struck the southern part of Japan's Ibaraki prefecture on Friday, authorities said, shaking buildings in Tokyo.