* Third day of mass testing in many Shanghai districts
* In a first, Beijing mandates vaccination proof for crowded venues
* China battles COVID outbreaks in several provinces
* Economy recovering, but foundation not solid, premier says (Adds detail on Shanghai cases, Premier Li comments)
By Brenda Goh and Roxanne Liu
SHANGHAI/BEIJING, July 7 (Reuters) - Millions of people in Shanghai queued for a third day of mass COVID-19 testing on Thursday as authorities in several Chinese cities scrambled to stamp out new outbreaks that have rekindled worries about growth in the world's second-largest economy.
Unless local officials succeed in preventing the virus from spreading, they could be compelled to invoke prolonged, major restrictions on residents' movement, under China's "dynamic zero COVID" strategy.
The country's most populous city, Shanghai, has just emerged from a painful two-month lockdown and is again on high alert - racing to isolate infections linked to karaoke services that had been taking place illegally.
Shanghai reported 54 new locally transmitted COVID cases for Wednesday, versus 24 the previous day. More than 70 cases confirmed in recent days are linked to the karaoke joints, authorities said.
Overall, mainland China reported 338 new local COVID cases for Wednesday, down from 353, with no new deaths, numbers that most countries would now consider insignificant.
But China's approach of rigorously stamping out outbreaks as they occur has residents wary of more of the kind of restrictions that have caused mental stress and financial hardship for many, disrupted global supply chains and overseas trade, and rattled financial markets.
"A resurgence of Omicron is not an issue in most other countries, but it remains a predominant issue for the Chinese economy," Nomura analysts wrote in a note, referring to the highly transmissible COVID variant.
As China is "by far the largest manufacturing centre in the world, any new waves of Omicron are likely to have a non-negligible impact", they added.
Shanghai, China's commercial hub, ordered most of its 25 million residents to take two compulsory COVID tests between Tuesday and Thursday.
Residents of the city frequently take self-administered tests in order to enter shopping malls or travel on public transport, and they also have to take part in city-wide testing every weekend till end-July.
Another 50 residential compounds and venues were locked down on Thursday in Shanghai, taking the total to 81.
PLAYING WHACK-A-MOLE WITH OUTBREAKS
Around half of China's 338 new cases were in the eastern Anhui province where more than 1 million people in small towns are locked down.
In Beijing, four new infections were reported, down from six the previous day.
The capital has mandated that from July 11 most people entering crowded venues, such as libraries, cinemas and gyms, will have to have been vaccinated.
After finding one COVID case involving someone who had arrived from Shanghai, the town of Xinjiang in the northern Shanxi province tested almost its entire 280,000 population, suspended taxis, ride hailing and bus services, and closed various entertainment venues.
In a different province, Shaanxi, which reported four new cases, the cultural and tourism authority requested travel agencies to cancel group tours in its capital Xian, famed for its Terracota Army.
China has justified its uncompromising coronavirus strategy by saying it is saving lives and is worth the "temporary" economic costs. Officials have contrasted the millions of COVID-linked deaths around the world with China's reported death toll of 5,226 since the start of the pandemic 2-1/2 years ago.
Analysts warn, however, that some costs may become permanent if China's debt burden increases and if curbs lead to investors and foreign talent reconsidering their presence in the country.
Premier Li Keqiang was quoted by state media on Thursday as saying that China's economy is recovering but the foundation of that recovery is not solid and hard work is still needed.
China is planning to set up a 500 billion yuan ($75 billion)state infrastructure fund to revive the economy, two people with knowledge of the matter have told Reuters. ($1 = 6.7000 Chinese yuan)
(Additional reporting by Wang Jing in Shanghai and Ryan Woo in Beijing Writing by Marius Zaharia and John Geddie Editing by Himani Sarkar, Simon Cameron-Moore and Frances Kerry)