BEIJING, July 1 (Reuters) - China shares were subdued on Thursday, largely giving up early losses, as gains in real estate firms and banks helped offset declines in industrial firms after weak factory data.

** At the close, the Shanghai Composite index was down 0.07% at 3,588.78, while blue-chip CSI300 index was up 0.11% after falling as much as 0.62% earlier.

** Among the worst-performing sectors, the industrial sub-index dropped 1.53% and the energy sub-index lost 0.74%.

** Data showed China's factory activity expanded at a softer pace in June, as the resurgence of COVID-19 cases in the export province of Guangdong and supply chain woes drove output growth to the lowest in 15 months.

** The manufacturing sector has gradually returned to normal but challenges linger, said Wang Zhe, senior economist at Caixin Insight Group.

** In a bright spot, the real estate sector and banking sector rose by 4.32% and 1.96%, respectively and lifted blue-chip shares.

** Investors remained wary on lofty valuations of certain sectors.

** "The fundamentals of the new energy auto makers and supply chain companies are strong, but investors including us have some valuation concerns," said Wang Qi, CEO at MegaTrust Investment (HK).

** Investors are keenly watching out for the upcoming first-half earnings season, which will largely determine the market outlook and sentiment for the rest of the year, Wang Qi added.

** The smaller Shenzhen index ended down 0.83% and the start-up board ChiNext Composite index was weaker by 0.63%.

** Around the region, MSCI's Asia ex-Japan stock index was weaker by 0.35%, while Japan's Nikkei index closed down 0.29%.

** Hong Kong's stock market is closed on Thursday for the Hong Kong Special Administrative Region Establishment Day.

(Reporting by Cheng Leng, Luoyan Liu and Andrew Galbraith; Editing by Amy Caren Daniel)