The Pacific Tsunami Warning Center said a tsunami watch was in effect for the entire Indian Ocean and individual countries, including Thailand, Indonesia, Sri Lanka and India, issued tsunami warnings.
People near the coast in six Thai provinces were ordered to higher ground.
The quake struck 308 miles southwest of the city of Banda Aceh, on the northern tip of Indonesia's Sumatra island, at a depth of 20.5 miles, the U.S. Geological survey said.
Indonesia's disaster management agency said power was down in Aceh province and people were gathering on high ground as sirens warned of the danger.
The quake was felt as far away as the Thai capital, Bangkok, and in southern India, residents said.
Hundreds of office workers in the Indian city of Bangalore left their buildings while the Indian port of Chennai closed down because of the danger of a tsunami, the port said.
The quake was in roughly in the same area as a December 26, 2004, quake of 9.1 magnitude, which sent huge tsunami waves crashing into Sumatra, where 170,000 people were killed, and across the Indian Ocean.
In all, the 2004 tsunami killed about 230,000 people in 13 Indian Ocean countries, including Thailand, Sri Lanka and India.
The 2004 quake was at a depth of 18 miles along a fault line running under the Indian Ocean, off western Indonesia and up into the Bay of Bengal.
The quake was also felt in Sri Lanka, where office workers in the capital, Colombo, fled their offices, and the southern Thai holiday island of Phuket, both of which were hit hard by the 2004 tsunami.
In Bangladesh, where two tremors were felt, authorities said there appeared to be no threat of a tsunami. Australia also said there was no threat of a tsunami there.