However, FMCG and IT stocks fell on sustained selling.
Overseas, European markets were mixed due to muted trading activity on account of Independence Day celebrations in the US.
Asian markets closed mostly higher despite geo-political concerns following North Korea's latest missile launch.
The NSE 50-share Nifty index opened higher at 9,619.75 and moved in a range of 9,643.65 and 9,607.35 before ending at 9,637.60, up 24.30 points, or 0.25 per cent.
It saw an intra-day movement of about 36.30 points.
Also Read
FMCG and IT fell by 0.72 per cent and 0.52 per cent, respectively.
The broader markets outperformed. Nifty mid-cap and small-cap indices gained 0.99 per cent and 1.34 per cent, respectively.
Major index gainers were Lupin 3.84 per cent, Vedanta 2.41 per cent, M&M 2.02 per cent, ONGC 1.81 per cent and Ultratech Cement 1.71 per cent.
A total of 1,112 scrips advanced, 576 declined, while 74 remained unchanged. Total securities that hit their price bands were 112.
Turnover in the cash segment rose to Rs 22,045.18 crore, from Rs 21,918.15 crore yesterday.
A total of 12,757.29 lakh shares changed hands in 7,806,685 trades. The market capitalisation of listed firms stood at Rs 12,606,524.30 crore.
Disclaimer: No Business Standard Journalist was involved in creation of this content