The Japan Meteorological Agency said there was no danger of a tsunami after the quake Friday. No damage was immediately reported.
The quake occurred off the coast of the northern main island of Hokkaido at a depth of 6.2 miles (10 kilometers) at 11:23 a.m. Friday (0223 GMT).
Japan is one of the world's most earthquake-prone countries. In 1995, a magnitude-7.2 quake in the western port city of Kobe killed 6,400 people.