The benchmark indices firmed up in the late afternoon trade to end in the green. Trading had been volatile through the day with the indices slipping in and out of the postiive zone.
The Sensex finished up 87.74 points or 0.32 per cent at 27,661.40. Similarly, the Nifty gained 32 points or 0.38 per cent to 8,360.55. All the major BSE indices gained.
Buying in stocks of banks, health care, capital goods and metals supported the indices.
FMCG, IT and realty stocks saw heavy selling.
Industrial production (IIP) numbers for May are slated to be released later in the day.
Major Sensex losers were Bharti Airtel (3.3%), HUL (2.0%), GAIL (1.9%), TCS (1.9%), ONGC (1.7%), and Bajaj Auto (1.7%).
Vedanta rose by 5.04 per cent, followed by BHEL 1.7%, Sun Pharma (3.34%), Reliance (1.4%), HDFC Bank (1.5%) and L&T (1.3%).
Meanwhile, foreign investors sold shares worth Rs 254.10 crore yesterday, as per provisional data.
Most active stocks on the NSE by volume were Adani Power, Suzlon, Unitech, Jindal Steel, Sterlite Technologies, Tata Motors, Essar Oil, Reliance Communications and Zee Media.
Global markets
Global financial markets rallied on Friday on hopes that last-minute concessions by Greek Prime Minister Alexis Tsipras would clinch a deal with the country's international creditors and save it from bankruptcy.
Stock markets across Europe and Asia rose more than 1 per cent, the euro gained and low-rated euro zone bond yields retreated, after a volatile week that saw Greece's banks remain shut following a referendum vote that rejected previous bailout terms and raised chances of a "Grexit" from the euro.
The new agreement is by no means a done deal. Greece's parliament still needs to throw its weight behind the proposals and trust with creditors needs to be rebuilt. But investors dialled down cautious trades and market volatility in Europe fell to its lowest in over two weeks.
The euro climbed 1.3 per cent against the yen to 135.60 and added 0.7 per cent against the dollar to trade at $1.1115.
Chinese stocks were also buoyed by a raft of support measures from Beijing that appeared to calm investors. Panic selling had slashed a third of the value off mainland markets since its peak in June.
Japan's Nikkei stock index erased gains and ended a volatile session down 0.4 per cent, closing below the psychologically significant 20,000 level for a weekly loss of 3.7 per cent. That was the biggest weekly drop since October.
The silver lining is that valuations have become more attractive, which was drawing retail investors and pension funds who usually buy stocks when they are falling, according to market participants.
"Most people think the worst is over," said Isao Kubo, equity strategist at Nissay Asset Management.