MELBOURNE, Australia — A new wave of coronavirus infections prompted officials to impose restrictions on some 5 million people in Australia's second-largest city, illustrating the difficulty of conquering the pandemic even in a country that had enjoyed relative success in taming its toll.

Authorities in Melbourne, the capital of Victoria state, said they would reinstate curbs for six weeks starting Wednesday night to try to beat back a surge in new cases that threatens to spiral out of control. Residents of the city and some surrounding areas will be required to stay at home except for essential activities such as certain work or study, food shopping, exercise or medical care, and they won’t be able to leave the metropolitan area.

In announcing the measures Tuesday, Daniel Andrews, the state premier, said a sense of complacency that had set in after most social-distancing rules were lifted in June was partly responsible for the jump in new infections. Victoria as recently as last month had reported daily new cases in the single digits, but on Tuesday reported a record 191 new cases, of which only 37 were linked to known outbreaks.

“These are unsustainably high numbers of new cases. It is simply impossible with case rates at this level to have enough contact tracing staff, to have enough physical resources . . . to continue to suppress and contain this virus without taking significant steps,” Andrews told reporters.

“We are in many respects in a more precarious, challenging and potentially tragic position now than we were some months ago.”

The resurgence of the virus in Melbourne echoes the difficulties facing the United States, where some areas, particularly in the South and West, are mandating masks and reimposing shutdowns as they report spiraling numbers of infections and hospitalizations.

Still, with a total of 8,755 cases and 106 deaths among a population of 25 million, Australia has largely avoided the devastating effects seen in many other Western countries. The United States has a population 13 times that of Australia but has recorded more than 1,200 times the number of deaths.

In Melbourne, the new measures will require some businesses to close, including beauty and personal care services, cultural and entertainment venues and community facilities. Cafes and restaurants will remain open but only for takeout and delivery.

The spike in cases coincided with wider testing; with more than 26,000 tests performed in a single day, Victoria has done nearly 1 million tests.

“This is not over, and pretending that it is because we all want it to be over is not the answer — it is indeed part of the problem,” Andrews said.

A day earlier, officials said they would close Victoria’s state borders to prevent the outbreak from spreading elsewhere.

Officials had already reinstated a partial lockdown for some areas of Melbourne after some residents in public housing complexes tested positive in recent days. About 3,000 residents in nine high-rise buildings were given an hour’s notice before being banned from leaving their apartments for at least five days as extensive testing is carried out.

Genomic sequencing has indicated some of the outbreak has emerged from guards and guests in hotel quarantine, where Australian citizens and permanent residents returning from overseas must isolate for 14 days.

So far, Victoria appears to be alone among Australia’s states in suffering a second wave of the pandemic. New South Wales, the most populous state, on Tuesday reported only seven new cases, while three states and two territories recorded none.

Yet epidemiologists say the nature of how the virus spreads means the second wave could have happened anywhere.

“The Victorian outbreak highlights what we’ve always known: that this virus has explosive potential and that we have a long road ahead of us,” said James McCaw, an expert in infectious diseases at the University of Melbourne.

“The breakdown in infection control in hotel quarantine — just one or two events across the many hundreds of people successfully managed through the system — has had a huge consequence.”

Catherine Bennett, chair of epidemiology at Deakin University, said a failure at the front line was key and that a new tipping point was occurring as the health system reached capacity due to the “sheer scale of keeping up with contact tracing.”

Bennett said the state had not been sufficiently prepared to shield high-risk vulnerable populations like the residents of the housing towers under hard lockdown, many of whom are new migrants, refugees, those with mental health issues and survivors of family violence.

Ahmed Dini, a resident of one of the towers, said Tuesday that residents felt they had been treated like second-class citizens, yet on the other hand they had received an outpouring of public support.

“These towers are like vertical cruise ships, we are like sitting ducks — we’re scared and we know there’s potential for the numbers to skyrocket very soon,” he said in an interview.

The second wave is also adding to anxiety about Australia’s economic recovery from the virus, which the central bank on Tuesday warned would be rocky. Prime Minister Scott Morrison had hoped that officials would be able to ease most restrictions and border closures this month.