An earthquake with a preliminary magnitude of 6.7 jolted islands off Japan's southernmost prefecture of Okinawa on Friday, the Japan Meteorological Agency said, but there were no immediate reports of injuries or damage.
A tsunami warning was issued for waves about 50 cm (20 inches), adding that the waves were thought to have reached some shores already.
The focus of the tremor was 40 km (25 miles) below the seabed near the diving resort island of Miyakojima, 1,900 km (1,200 miles) southwest of Tokyo.
The earthquake was followed by an aftershock with a preliminary magnitude of 6.2.
Earthquakes are common in Japan, one of the world's most seismically active areas. The country accounts for about 20 per cent of the world's earthquakes of magnitude 6 or greater.
In March, a 6.9 magnitude quake struck the Noto peninsula in Ishikawa prefecture, about 300 km west of Tokyo, killing one person, injuring more than 200 and destroying hundreds of homes.
In October 2004, an earthquake with a magnitude of 6.8 struck the Niigata region in northern Japan, killing 65 people and injuring more than 3,000.
That was the deadliest quake since a magnitude 7.3 tremor hit the city of Kobe in 1995, killing more than 6,400.