The quake happened at 1817GMT at a focal depth of 10km, the US Geological Survey reported.
Tonga, a 170-island archipelago about halfway between Australia and Tahiti, is part of the Pacific "Ring of Fire" - an arc of earthquake and volcanic zones stretching from Chile in South America through Alaska and down through Vanuatu to Tonga.
An undersea volcano has been erupting for days near Tonga, shooting smoke, steam
and ash hundreds of metres into the sky, without posing any danger to islanders.
Residents of Tonga said the steam and ash column first appeared on Monday morning, after a series of sharp earthquakes were felt in the capital.