Geoscience Australia said the quake hit at a depth of 3km at Sunbury, about 40km northwest of the city, at 11.41pm on Sunday.
More than 22,750 people contacted the agency to report they had felt shaking.
Most of the reports are centred around Melbourne, but there were some as far north as Bendigo and as far south as Hobart, Geoscience Australia said in a statement.
Seismology Research Centre Chief Scientist Adam Pascale posted on Twitter that it had been the largest earthquake in over 100 years in the Melbourne metropolitan area.
Victoria's SES state commander David Baker said his crews had only received three calls for help following the quake.
"We were fortunate that there was no damage or consequences as a result of the earthquake last night," Mr Baker told ABC News.
He said there was always a concern of aftershocks.
In the last five years, four other earthquakes of magnitude three or greater have been recorded in Victoria, including a 5.9 magnitude north of Rawson in 2021 which caused some localised damage.
On average, around 100 earthquakes of magnitude three or larger are recorded in Australia each year.
The Bureau of Meteorology said there is no tsunami threat to the Australian mainland, islands or territories as a result of the quake.