The quake hit at a depth of seven kilometres about 54 kilometres off Bowen in Queensland state at 0430 GMT, the United States Geological Survey said.
Buildings in Townsville city were evacuated, the Townsville Bulletin reported, but police said there were no reports of major damage.
Australia's Bureau of Meteorology said there was no tsunami warning for the island continent.
"It's been widely felt right up the coast, from Sunshine Coast up to north of Townsville, so quite a lot of the Queensland coast has felt some shaking," Geoscience Australia senior seismologist Jonathan Bathgate told AFP.
More From This Section
"We would expect to get aftershock activity after an event of this size."
Townsville resident John Towning said the shaking lasted for about six to seven seconds.
"I thought, 'there's no train around, no plane around', then I got up and had a look and I thought, 'geez, the whole bloody place is shaking'," Towning told the Australian Broadcasting Corporation.
"I sat down again and it was like the bloody chair was vibrating... It was more funny than scary. You don't normally get those things here."
The strongest recorded quake in Australia was a 6.6-magnitude earthquake that hit the small mining town of Tennant Creek, Northern Territory, in January 1988, according to Geoscience Australia.