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.
On 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.
Elsewhere, a strong earthquake rocked Mexico City and Acapulco Thursday, shaking buildings and sending some people fleeing into the streets.
So far, no reports of injury or damage.
The quake was centered 25 miles east of the resort of Zihuatanejo. It had a preliminary magnitude of five-point-seven and struck shortly after 5:30 p-m local time, according to the National Earthquake Information Center in Golden, Colorado.
It was followed by at least one strong aftershock.
Some residents ran from their highrise apartments in Mexico City, while tourists fled oceanside hotels in Acapulco as a precaution.
Because the quake occurred on New Year's Day, most people were home with their families or on vacation.