Mumbai: Benchmark equity indices Sensex and Nifty gained more than 5% in July to record highs, logging their best monthly gains in at least 16 months, paced by continued inflows from domestic and foreign investors, and helped by relatively stable global markets.

BSE’s 30-share Sensex closed 0.63%, or 205.06 points, higher on Monday to a record close of 32,514.94 points, while the National Stock Exchange’s 50-share Nifty climbed 0.63%, or 62.60 points, to a lifetime high of 10,077.10 points.

The indices gained 5.15% and 5.84%, respectively in July, logging their best gains since March 2016.

“The dollar index declined, increasing the flows available for riskier assets such as those in emerging markets. This helped the rally this month," said Ritesh Jain, chief investment officer (CIO), at BNP Paribas Mutual Fund

In July, the dollar index, which measure the greenback’s strength against six major currencies, fell 2.28%, registering its fifth consecutive monthly loss and the steepest since January 2017.

“India has performed well but pretty much in line with global emerging markets. So it is excitement in global markets about EMs (emerging markets) that has helped most recently," said Maarten-Jan Bakkum, senior emerging markets strategist at NN Investment Partners, in an e-mail from the Hague, Netherlands.

Foreign institutional investors (FIIs) pumped in a net of $580.56 million in Indian shares since start of July to 27 July, while domestic institutional investors (DIIs) invested a net of Rs3,017.94 crore since the start of the month to 28 July.

Emerging markets across the board did well in July. Among the key emerging market equity markets, South Africa and Turkey led with gains of 7.70% and 6.37% respectively.

Back home, corporate earnings for the June quarter were a dampener, as de-stocking and discounts ahead of the implementation of the Goods & Services Tax Act hit profit and loss accounts.

A Mint analysis showed that the June quarter profits and sales of 221 BSE-listed companies, after adjustment for one-time items, were the lowest in at least 14 quarters for which comparable figures were available, according to data compiled by database provider Capitaline.

Net sales of these firms rose 2.57% in the three months ended 30 June from a year earlier, while adjusted net profit fell 3.64%, the first drop in more than three years.

Lack of earnings growth at a time when stock prices are trading at record highs has led valuations to overshoot.

“The overall valuations have been high for quite some time, as earnings are not catching up," added Jain.

BSE’s Sensex trades at 18.82 times 1-year forward earnings, compared to its 5-year and 10-year historical average of 15.08 times and 14.96 times.

Good monsoon rainfall has kept investor sentiment upbeat.

India’s south-west monsoon, which waters about half the country’s farmland, is set to be near normal this year even if it weakens in the remaining two months, Bloomberg reported on Thursday, citing the India Meteorological Department.

“There is a sectoral rotation happening in favour of the beaten down sectors, on value buying as the already-owned sectors look very expensive," said Jain of BNP Paribas.

Energy and telecom sectors were the key gainers, with their respective sectoral indices rising 10.74% and 10.62% respectively.

While the risk of sluggish earnings keeps looming, the market may continue to be upbeat on liquidity flows.

“India remains one of the best stories in EM. Growth is higher than elsewhere. Particularly relevant are the prospects for more interest rate cuts and some tentative signs that credit growth has started to pick up," said Bakkum of NNIP.

“Also, with global investor risk appetite towards EM strengthening, we should expect more flows to India, which is one of the best endogenous growth stories. And local investment flows to equities should remain strong. This is a key driver of Indian equities for the coming years, as Indian interest rates decline more," added Bakkum.