BENGALURU, June 28 (Reuters) - India's blue-chip Nifty 50 and Sensex indexes rallied to hit record highs on Wednesday, lifted by gains in some Adani group stocks and heavyweight financials on the back of persistent foreign buying, stable macros and steady corporate earnings.

The Nifty 50 rose as much as 1.03% to a record high of 19,011.25, after struggling to breach the level last week amid hawkish central bank commentary.

Both Nifty and the S&P BSE Sensex notched fresh all-time closing highs, with the Nifty closing 0.82% higher at 18,972.10 and Sensex closing 0.79% higher at 63,915.42.

The Sensex already hit a record high last week, while the midcaps and smallcaps hovered around fresh record and 52-week highs, respectively.

Twelve of the 13 major sectoral indexes rose, with financials climbing 0.54%.

Adani Enterprises, the Nifty's top gainer, rose over 5% on a report that GQG Partners and other investors bought around $1 billion of additional stake in the conglomerate's firms.

Index heavyweights HDFC and HDFC Bank extended gains after announcing plans to complete their proposed merger on July 1.

"Investors are massively turning positive on risk assets, taking comfort from the recent fall in inflation, anticipating the rate-hike cycle ending," noted Amar Ambani, group president and head of institutional equities at YES Securities.

Analysts also cited the return of foreign buying and steady corporate earnings as triggers for the ongoing rally.

Foreign portfolio investors have bought 859.83 billion rupees ($10.49 billion) worth of equities in fiscal 2024 so far, after offloading 1.4 trillion rupees and 376.32 billion rupees in fiscal 2022 and 2023, respectively.

However, the benchmarks were relatively expensive compared to their global peers, Refinitiv data showed.

Analysts cautioned that the market could consolidate again as valuations were still expensive.

Though the Nifty 50's price-to-earnings ratio - measuring the valuation of an index or security - remained below its long-term average, the skew was due to the extraordinary post-Covid rally in 2020 and 2021, they said.

($1 = 81.9950 Indian rupees)

(Reporting by Bharath Rajeswaran in Bengaluru; Editing by Sonia Cheema and Janane Venkatraman)