The epicentre of the quake, that took place at about 9.15am local time on Wednesday, was northeast of Australia’s second-most populous city near the town of Mansfield.
Prime Minister Scott Morrison said “we have had no reports of serious injuries and that is very good news”
"It can be a very disturbing event, an earthquake of this nature. They are very rare events in Australia and as a result, I am sure people would have been quite distressed and disturbed."
Images and video footage circulating on social media showed rubble blocking one of Melbourne's main streets, while people in northern parts of the city said on social media they had lost power and others said they were evacuated from buildings.
There was damage to brickwork in Chapel Street, where a fast food restaurant partially collapsed, and in the inner suburb of South Yarra.
The quake was felt as far away as the city of Adelaide, 800 km (500 miles) to the west in the state of South Australia, and Sydney, 900 km (600 miles) to the north in New South Wales state, although there were no reports of damage outside Melbourne and no reports of injuries.
It was followed by two aftershocks of 4.0 and 3.1 magnitude.
Victoria’s State Emergency Service warned residents to be alert for possible aftershocks.
“If you are located in Victoria, you are in danger. Expect aftershocks, stay away from damaged buildings and other hazards. Avoid driving, except for emergencies,” the authority said.
The earthquake was the largest to rattle Australia since a magnitude 6.6 earthquake struck 130 miles off the northwest coastal town of Broome in 2019.
The quake on Wednesday measured higher than the country's deadliest tremor, a 5.6 in Newcastle in 1989, which resulted in 13 deaths.
Tim Wiebusch, from the Victoria State Emergency Service said the lockdown likely helped prevent serious injuries from occurring.
“We were probably very fortunate that with the situation in Melbourne at the moment there aren’t a lot of people out moving during the day,” he said.
The epicentre of the quake near Mansfield was about six miles below the surface.
Quakes are relatively unusual in Australia’s populated east due to its position in the middle of the Indo-Australian Tectonic Plate, according to Geoscience Australia.
The quake presented a potential disruption for anti-lockdown protests expected in Melbourne on Wednesday, which would be the third day of unrest that has reached increasing levels of violence and police response.