Health officials were attempting to lock the store in Xuhui district down as a customer had been in close contact with a positive Covid case.
Videos show the guards closing the doors at one point, but a crowd forced them open and made their escape.
Shanghai endured a severe two-month lockdown earlier this year.
Since then, in line with the country's strict "zero-Covid" strategy, the city of 20 million people has ordered flash lockdowns of areas where positive cases or their close contacts have been detected.
Many have been locked down in unusual locations - including hot pot restaurants, gyms and offices.
The Ikea store's sudden shutdown was ordered because a close contact of a six-year-old boy who tested positive after returning to Shanghai from Lhasa in Tibet had visited, Shanghai Health Commission deputy director Zhao Dandan said on Sunday.
He did not say when the close contact was believed to have been at the store.
Those who were at the Ikea store and related areas must quarantine for two days followed by five days of health monitoring, Mr Zhao said.
By Sunday nearly 400 close contacts of the six-year-old boy - who is asymptomatic - had been traced while 80,000 people had been ordered to undergo PCR testing, according to Shanghai Daily.
Ikea's customer service said on Sunday that the store was shut due to Covid curbs.
The flagship Xuhui store, opened in 1998, was the Swedish furniture retailer's first outlet in China. It now has 35 outlets across the country.
China has stuck to its zero-Covid approach to slowing the spread of the coronavirus despite its huge impact on the economy and increasingly vocal objection from the public.
The scenes of panic at Ikea follow videos last week showing people in another part of Shanghai running out of a building over rumours of an abnormal Covid test result.
Shanghai's citywide lockdown earlier this year saw widespread reports of food shortages and poor living conditions in quarantine centres.
Frustrated residents were filmed engaging in heated arguments with pandemic staff and screaming from windows in protest against the restrictions during this time.
-- Courtesy of BBC Sport