Japan's Meteorological Agency has issued a tsunami warning from the quake, which occurred about 130 kilometers (80.6 miles) off the southern coast of Chichi Island in the Pacific Ocean. The offshore quake struck at around 2:20 a.m. (1720 GMT) at the depth of 10 kilometers (6.2 miles).
The agency issued a tsunami alert of up to 2 meters (6 feet) for nearby islands and warnings of milder tsunami for the southern coasts on the main Japanese island.
A minor swelling of waves of about 30 centimeters (1 foot) was observed on the island's shorelines about 40 minutes after the quake, the agency said.
There was no immediate report of any damage or injuries.
"It shook quite violently. I'm sure everyone was scared," said Kenji Komura, principal at a high school on the island. He rushed to school, where about 20 students gathered to take refuge. Despite the shaking, nothing fell on the floor or got damaged at school, Komura said.
About 170 people evacuated to several community centers and school buildings on the Chichi and nearby Haha islands, public broadcaster NHK said.
Tomoo Yamawaki, a fisheries cooperative official on the Chichi island, said he has observed no significant swelling of the waves so far.
"We've taken all fishing boats on the island off coast to protect them from the tsunami," said Yamawaki, who is in charge of community tsunami broadcast, told NHK. "We haven't observed any significant change in the waves, but we urge all residents to immediately evacuate to a safer place."
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.