People stand outside a shopping mall following an earthquake in Jakarta, Indonesia, Friday, Aug. 2, 2019. A strong earthquake struck off the coast of Indonesia's Java island on Friday, swaying buildings as far away as the capital and prompting national authorities to urge those in coastal areas to head to higher ground in case of a tsunami.

Indonesian authorities urged coastal-dwellers to head for higher ground on Friday after a tsunami warning with potential for waves up to three metres (10 feet) following a powerful earthquake off the islands of Sumatra and Java.

The Indonesian geophysics agency issued the warning after the quake, which the U.S. Geological Survey initially said had a magnitude of 7 and hit at a depth of 59 km (37 miles), about 227 km (141 miles) from the city of Teluk Betung.

The magnitude was later lowered to 6.8.

The geophysics agency said there was a risk of a tsunami of in southern parts of Pandeglang and Panaitan island in Banten province, and Lampung in Sumatra.

Indonesia's disaster mitigation agency said on Twitter that residents near coastlines at risk should "immediately evacuate to higher ground".

There were no immediate reports of damage or casualties, but strong tremors were felt in Jakarta, the capital, prompting people to run out of office buildings.

The quake could also be felt in other cities such as Yogyakarta on Java island.

"It was so scary," said Gustiani Pratiwi, who was carrying two children near an apartment block in Jakarta when she felt the quake strongly.

Indonesia is situated on the so-called Pacific Ring of Fire, which is frequently hit by earthquakes and sometimes accompanying tsunamis.

The most devastating in recent Indonesian history was on Dec. 26 in 2004, when a magnitude 9.5 quake triggered a massive tsunami that killed around 226,000 people along the shorelines of the Indian Ocean, including more than 126,000 in Indonesia.

Last year, a tsunami hit the city of Palu in Sulawesi island, killing thousands, while a crater collapse at the Anak Krakatau volcano triggered a tsunami that killed at least 430 people in an area near the latest quake.

At Carita beach in Banten, which was affected by the Anak Krakatau quake, a resident described the alarm in the area.

"We are panicking a lot," Sandi, a resident of Carita beach, told Metro TV by telephone.