The Meteorology and Geophysics Agency said the quake had a magnitude of 6.1. The U.S. Geological Service recorded the temblor at 5.4.

The undersea quake struck shortly before dawn in the Straits of Lombok, about 18 miles off the east coast of Bali, the agency said.

Both Bali and Lombok are popular with foreign tourists, but initial reports said the quake did no damage in areas frequented by vacationers.

Thousands of people on the tropical islands in eastern Indonesia fled their homes when the quake hit.

“We all ran for fear our houses were going to cave in,” said Maria, an employee at the telephone exchange on Lombok who asked to be identified by a single name.

At least 22 people were injured on Lombok, including a 12-year-old boy whose legs were broken when a house fell on top of him, said Sri, a doctor in the island’s capital, Mataram. Like many Indonesians, Sri goes by a single name.

About 12 buildings were damaged on the island’s western cost, officials said.

At least 7 injured on BaliOn Bali, at least seven people were injured as they ran in panic from their houses on the east of the island, said Gede Suryana, a hospital staffer in the town of Karangasem, where the roofs of several buildings sustained light damage.

The town’s hospital was also damaged, and officials were setting up a tent in the grounds of the building to treat patients, Suryana said.

A police officer in Karangasem said “up to 100” homes, schools and places and worship may have been damaged, but declined to give precise figures. There were no reports of tidal waves.

Indonesia, the world’s largest archipelago nation, is prone to earthquakes because of its location on the so-called Pacific “Ring of Fire” — volcanic arcs and oceanic trenches partly encircling the Pacific Basin.