TOKYO - An earthquake with a preliminary magnitude of 5.9 shook eastern Japan early Friday, the weather agency said.