Staff and visitors were evacuated from a remand centre in Ravenhall after clashes involving hundreds of inmates began at midday on Tuesday.
Heavily armed police stormed the prison in the early hours of the morning, according to the Victorian government.
The Corrections Department said the riot may have started because of a smoking ban in state prisons.
Several prisoners were hurt in the riot and were treated by medical staff, and two staff members suffered minor injuries, said prison authorities.
The riot, in which hundreds of prisoners lit fires, broke walls and smashed windows, started not long before a smoking ban was to be introduced in all Victorian correctional facilities.
About 84% of Victorian prisoners are smokers, according to government figures.
The government said it was introducing the ban to improve the health of prison staff and inmates.
Corrections Victoria said the operation to end the riot was difficult and conducted under the cover of darkness to protect prison staff.
Victoria's Minister for Corrections, Wade Noonan, said  "a thorough investigation" would be undertaken into what caused the riot and how authorities responded to it.
Police have regained control of a prison on the outskirts of Melbourne following a major riot.