The epicentre of the quake was located inland of northernmost Hokkaido at a depth of 37 kilometres (23 miles), close to the region's capital city Sapporo.
The Japan Meteorological Agency put the quake's strength slightly higher at 5.8 magnitude, adding that there was no risk of a tsunami.
Powerful typhoon Neoguri lashed Japan's southern Okinawa islands today, forcing more than half a million people to seek shelter, as the region's worst storm in years damaged buildings, downed trees and brought air and sea traffic to a halt.
But thanks to strict building codes, even powerful quakes that might wreak havoc in other countries frequently pass without causing much damage.
In May, a strong 6.0-magnitude earthquake shook buildings in the Japanese capital Tokyo, injuring 17 people.