Following two months of frustration, despair and economic loss, Shanghai's draconian COVID-19 lockdown ended at midnight on Wednesday morning, prompting celebrations tempered with fear that an outbreak could return.

Most of Shanghai's 25 million residents can now freely leave home, return to work, use public transport and drive their cars - a moment that for many in China's largest and most cosmopolitan city felt like it would never arrive.

At midnight, small groups gathered in the city's former French Concession neighbourhood whistled, shouted "ban lifted" and clinked glasses of champagne.

Earlier, streets were lively as residents picnicked on grassy patches and children rode bikes down carless roads. Dancing retirees, a common evening sight in Chinese cities, strutted their stuff for the first time in months in open air plazas and along the Huangpu river.

Shanghai Disneyland, which has yet to announce a reopening date, livestreamed a lightshow to "celebrate the lifting of Shanghai's lockdown". They used a Chinese expression that also means "ban" that city officials have avoided.

Under streetlamps, barbers gave haircuts to residents who had grown shaggy under lockdown. On the WeChat social media platform, shops announced their reopening plans.

"I walked the dog and the dog is pretty excited, because it has been a really long time for it to come outside," said Melody Dong, who was looking forward to eating hot pot and barbecue - foods that are difficult to make at home.

Shanghai's ordeal has come to symbolise what critics say is the unsustainability of China's adherence to a zero-COVID policy that aims to cut off every infection chain, at any cost, even as much of the world tries to return to normal despite ongoing infections.

The lack of a roadmap to exit from an approach that is increasingly challenged by the highly contagious Omicron variant has rattled investors and frustrated businesses.

COVID curbs in Shanghai and numerous other Chinese cities have battered the world's second-largest economy and tangled global supply chains, although case numbers have improved and curbs have eased from the depths of April's lockdowns.

China says its approach, a signature policy of President Xi Jinping, is needed to save lives and prevent its healthcare system from being swamped. The uncertainty and discontent caused by China's COVID management has created unwanted turbulence in a sensitive political year, with Xi poised to secure a third leadership term in the autumn.

"The mood tonight is a bit like high school days. On the eve of the school year I was full of expectations for the new semester but I feel a little uneasy in my heart," wrote one user of the Twitter-like Weibo.

A CITY SCARRED

During two months, numerous residents of the country's most important financial and economic hub struggled to get enough food or medical care. Families were separated and hundreds of thousands were forced into centralised quarantine facilities.

At the factories and offices that remained open - including those of Shanghai government officials - workers lived on-site in "closed-loops", bunking on makeshift beds, with many of them only now able to return home.

Curbs were lifted for about 22.5 million people in low-risk areas. Residents must still wear masks in public and avoid gatherings. Restaurant dining remains banned. Shops can operate at 75% capacity. Gyms will reopen later.

Residents will have to test every 72 hours to take public transport and enter public venues, heralding what may become a "new normal" in many Chinese cities. Those testing positive, and their close contacts, face onerous quarantines.

During lockdown, Shanghai residents staged rare protests, banging on pots and pans from their windows and evading censors to vent on China's heavily policed social media. Frustrations stemmed from the lockdown itself as well as heavy-handed and often uneven enforcement and unclear communication.

"The Shanghai government needs to make a public apology in order to obtain the understanding and support of the people of Shanghai and repair the damaged relationship between the government and the people," Qu Weiguo, a professor at Fudan University's school of foreign languages, posted on WeChat.

On Tuesday, the city's largest quarantine facility - a 50,000-bed section of the National Exhibition & Convention Center - discharged the last two of the 174,308 COVID-postive cases who had been housed there. It declared itself shut.