But the flagship Sensex cut a sorry figure as it closed at a three-week low, hit by selling towards the close.
Both the indices registered their second straight weekly fall by losing 205.66 points, or 0.65 per cent, and 80.20 points, or 0.82 per cent, respectively.
"Market continued to consolidate due to lack of major triggers to support the upmove while FIIs were net sellers, which added fears to the stability of the rupee. The USFDA overhang continues to impact pharma," said Vinod Nair, Head of Research, Geojit Financial Services Ltd.
At one point, the broader Nifty went past the 9,600- mark. At the close, however, it was up 10 points, or 0.10 per cent, at 9,588.05.
After a higher opening, the Sensex scaled the day's high of 31,182.73, but closed down 19.33 points, or 0.06 per cent, at 31,056.40. The index was seen nearer to this level on May 26 when the closing was 31,028.21.
The gauge had lost 80.18 points in the previous session.
Risk appetite got a push after India's exports grew 8.32 per cent to USD 24.01 billion in May. Global crude falling to a 7-month low supported the positive mood.
However, trade deficit soaring to nearly 30-month high of USD 13.84 billion, largely due to increase in gold imports, forced investors to go in for a cautious approach.
Asia saw a mixed trend and Europe a higher opening.
Tata Motors led from the front, up 1.57 per cent, on its fund-raising plans. ITC Ltd, Adani Ports, SBI and NTPC rose.
Lupin ended with most losses, down 4.40 per cent. Ipca Laboratories tanked 8.08 per cent amid increasing scrutiny from the US healthcare regulator.
While the BSE FMCG rose followed by consumer durables, the healthcare index slumped 1.52 per cent.
The broader markets pulled ahead, outperforming the key indices.
Domestic investors bought shares worth a net Rs 854.85 crore while foreign portfolio investors sold shares worth Rs 654.35 crore yesterday, as per provisional data.