An earthquake of magnitude 6.1 struck off Indonesia's Sumatra island on Tuesday at a depth of 29 km (18 miles), the country's geophysics agency said.