Sri Lanka issued a tsunami warning across the island on Wednesday and the disaster management centre asked residents on the coast to move inland to avoid being hit by any large waves.
A government statement said waves could hit the island's eastern port district of Trincomalee by about 10:40 GMT and urged an orderly evacuation of the coastal strip.
"There is a strong possibility of a tsunami hitting the island after the earthquake in Indonesia," meteorological department deputy director M. D. Dayananda said.
He said the quake in Indonesia was felt in Sri Lanka, which is 1,340 kilometres (840 miles) north-west from the location of the quake.
Some 30,000 people were killed in Sri Lanka in the 2004 tsunami, which was also caused by an undersea earthquake off Indonesia. It devastated much of Sri Lanka's coastline.