The 2018 Lombok quake that killed 16 people and destroyed hundreds of buildings. [AFP]

A magnitude-6.5 earthquake struck off the coast of Indonesia's Java island on Saturday, the country's Meteorology, Climatology, and Geophysical Agency (BMKG) reported.

The quake, which the United States Geological Survey recorded at a magnitude of 6.1, was felt in capital Jakarta -- where people were forced to evacuate buildings -- and in nearby Bandung.

"I screamed to my wife and kids to tell them to get out of the house," Iman Krisnawan, a 47-year-old resident of Bandung, told AFP.

"Usually, earthquakes lasted about 5 seconds, this one lasted between 10-15 seconds."

There was no tsunami alert, according to BMKG. The USGS reported the depth at 68.3 kilometres (42 miles).

Indonesia, a vast archipelago nation, experiences frequent earthquakes due to its position on the Pacific "Ring of Fire", an arc of intense seismic activity where tectonic plates collide that stretches from Japan through Southeast Asia and across the Pacific basin.

A magnitude-6.2 quake that shook Sulawesi island in January 2021 killed more than 100 people and left thousands homeless.

In 2018, a magnitude-7.5 quake and subsequent tsunami in Palu on Sulawesi killed more than 2,200 people.

And in 2004, a magnitude-9.1 quake struck Aceh province, causing a tsunami and killing more than 170,000 people in Indonesia.