India's blue-chip stock indexes logged their best week since early February on Friday, led by metal stocks, while sustained domestic buying cushioned persistent foreign outflows.

Both the NSE Nifty 50 and S&P BSE Sensex gained about 2% this week, their best since the week ended Feb. 2.

Twelve of the 13 major sectors logged weekly gains, rising between 0.5% and 6.6%.

Metals surged 6.6%, helped by a cooling U.S. inflation which led to a moderation in U.S. dollar, and top consumer China's steps to allow local governments buy some apartments and relax mortgage rules.

Automaker Mahindra & Mahindra surged 14.66%, its best week in 39 months, buoyed by March-quarter profit beat and positive commentary by brokerages on its earnings outlook. The broader Nifty Auto index rose about 2%.

Real estate stocks climbed 6.5%, led by a post-results rally in Oberoi Realty, which jumped 18.6%.

U.S. interest rate-sensitive information technology stocks gained 1.4%, boosted by softer-than-expected U.S. inflation data, which revived hopes of early rate cuts.

"Overall, the market is showing positive momentum with bulls returning, despite profit booking by some foreign investors," said Vikram Kasat, head of advisory at Prabhudas Lilladher.

The sustained foreign selling, which is at a 16-month high, was cushioned by persistent domestic buying.

"Domestic buying, which has continued for 18 straight sessions and steady inflows from mutual funds are keeping markets stable," said Pramod Gubbi, co-founder of Marcellus Investment Managers.

At close of trade on Friday, the blue-chip Nifty was up 0.28% to 22,466.10, while the Sensex rose 0.34% to 73,917.03.

Volatility in markets hovered around 19-month highs hit on Monday, ahead of elections results on June 4.

The broader, more-domestically focussed small- and mid-caps outperformed the benchmarks, rising 1.65% and 0.88% respectively on strong earnings from several constituents.

Indian stock markets will trade in a special session on Saturday, to test preparedness during emergencies.

(Reporting by Dimpal Gulwani and Bharath Rajeswaran in Bengaluru; Editing by Nivedita Bhattacharjee and Varun H K)