BENGALURU, July 18 (Reuters) - Indian shares advanced on Tuesday, led by index heavyweights HDFC Bank after strong quarterly results and Reliance Industries ahead of the demerger of its financial services unit.

The Nifty 50 rose 0.21% to 19,753.05, while the S&P BSE Sensex gained 0.24% to 66,752.84 as of 10:09 a.m. IST. Both benchmarks rose over 0.5% to hit new all-time highs.

Nine of the 13 major sectoral indexes logged gains, with the high-weightage financials rising 0.8%. HDFC Bank was the top gainer in the index, aided by positive commentary from analysts on its June-quarter results.

Reliance Industries rose over 1%, before trimming some gains. The stock has risen over 6.2% since July 8, when it fixed the record date for the demerger.

Analysts expect the conglomerate to gain further ahead of the demerger effective July 20.

Broader markets, however, remained volatile with smallcaps losing 0.4% and midcaps logging marginal gains.

Strong foreign portfolio investment (FPIs) flows have sustained the rally in Indian equities and powered them to new lifetime high levels, according to Pankaj Chhaochharia and Abhimanyu Godara, equity analysts at Antique Stock Broking.

FPIs have been net buyers in Indian equities since March. They bought 339.39 billion rupees ($4.14 billion) worth of shares so far in July, according to National Securities Depository data.

The two analysts expected most sectors to report in-line earnings and identified oil & gas, cement and capital goods as sectors that could spur a positive earnings surprise.

Wall Street equities closed higher overnight on strong earnings outlook and cooling inflation, while Asian markets edged lower, dragged by weak China data. The MSCI Asia ex Japan lost 0.7%.

Among individual stocks, Sheela Foam

rose

15.41% to a seven-month high on an all-cash deal worth around $262 million to buy rival Kurlon, while IT firm LTIMindtree

lost

over 3.5% after missing June-quarter profit view.

($1 = 82.0525 Indian rupees) (Reporting by Bharath Rajeswaran in Bengaluru; Editing by Janane Venkatraman)