The 6.4 magnitude quake hit the central island of Lombok just before 07:00 local time on Sunday.
The island attracts tourists from around the world due to its beaches and hiking trails, and is located about 40km (25 miles) east of Bali.
More than 160 people are injured and thousands of homes are damaged, officials say.
A Malaysian tourist who was on a hiking trip to Mount Rinjani is among those killed.
The US Geological Survey said the epicentre of the earthquake was 50km (31 miles) north-east of the city of Mataram, in northern Lombok.
It was followed by more than 60 smaller earthquakes, with the largest recorded at a magnitude of 5.7.
Sutopo Purwo Nugroho, a spokesman for the country’s disaster agency, said that most casualties occurred when victims were hit by debris and falling blocks of concrete.
“The main focus now is evacuation and rescue. Some of the injured are still being treated at clinics,” he said.
He also posted images showing collapsed buildings and streets littered with rubble.
“The quake felt so strong… tourists were panicked and frightened and escaped from hotels,” Lalu Muhammad Iqbal, a civil protection director at the foreign ministry, told BBC Indonesian.
BBC Marathi journalist Vinayak Gaikwad was on Gili Trawangan island, about 7km from Lombok, at the time of the earthquake.
“The tremors were strong – I noticed waves in the hotel pool,” he said. “A group of us ran out of the hotel.
“Thirty minutes later there was the first strong aftershock. The locals were worried because many of their structures are made from wood and bamboo, but the tourists were the most scared.”
UK tourists Katherine and Alexis Bouvier, who are on honeymoon in Lombok, told the BBC: “We were woken by the earthquake at approximately 06:45 – it was pretty terrifying.”
Landslides had cut off the water supply and electricity for some houses, they said.
“We passed multiple water trucks as we were travelling south. A lot of hikers were stranded. They told us about cement falling from ceilings and cracks in the buildings.”
Mount Rinjani National Park, a popular destination for trekkers, has been closed due to landslides.
Climber Khairul Azi told the New Straits Times he and a group of hikers were “unable to get out of the area because many roads have been cut off”.
“The situation here is hectic and we’re still trying to make contact with the other Malaysian climbers,” he added.
Indonesia is prone to earthquakes because it lies on the Ring of Fire – the line of frequent quakes and volcanic eruptions that circles virtually the entire Pacific rim.
More than half of the world’s active volcanoes above sea level are part of the ring.
A magnitude 6.5 quake struck off the north-east coast of Sumatra island in 2016, killing dozens of people and displacing more than 40,000.