Indonesia issued a tsunami warning within minutes of 6.8-magnitude quake on Friday night. The warning last two hours and sent people living along the coastline fleeing to higher ground.
The strong quake was felt in the capital Jakarta and people rushed out of high-rise buildings.
One person died of a heart attack amid the panic in the province of Banten on Java and at least four others were injured, the disaster mitigation agency said in a statement.
The agency said people who took to higher ground, including about 1,000 taking shelter in the gubernatorial office in the Lampung province, had returned home.
The quake destroyed 34 houses and caused minor damage to dozens of other buildings, the agency said.
The U.S Geological Survey put the epicenter in the Indian Ocean about 227 km (141 miles) from the city of Teluk Betung on Sumatra.
Indonesia is situated on the so-called Pacific Ring of Fire, which is frequently hit by earthquakes and sometimes accompanying tsunami.