An earthquake with a preliminary magnitude of 5.9 rattled eastern Japan, including the Tokyo area, early on Sunday.