Markets reversed early losses to rebound in late trades on Thursday, amid firm European cues, led by engineering major L&T and software major Infosys.
The Sensex gained 174 points to end at 18,805. Nifty ended up 56 points at 5,708.
Asian shares ended lower on Thursday after Standard & Poor's cut Spain's rating two notches to BBB- minus, one step from junk status, late on Wednesday, warning that an intensifying recession and poor response from euro zone policymakers to the crisis had left Spain highly vulnerable.
The Nikkei, Shanghai Composite and Straits Times ended down 0.04-0.8%. However, Hang Seng ended up 0.4%.
Further, European shares staged a recovery after opening lower follwowing Spain's downgrade.
The FTSE-100, CAC-40 and DAX were all trading higher by 0.5-0.7% each.
Meanwhile, the IMF prodded Europe and the United States to act faster to resolve their debt troubles, blaming plodding progress for creating economic uncertainty and slowing global growth.
Christine Lagarde, the head of the International Monetary Fund, said she expected "courageous and cooperative action" as she laid blame on Europe and the United States for fostering a sense of unease that has led companies to delay investment and hiring.
The broader markets gained in line with the benchmark index.
The BSE Mid-cap index up 1.3% while Small-cap index was up 1%.
According to provisional data, foreign institutional investors (FIIs) remained buyers of Indian stocks on Wednesday.
All the sectoral indices traded in the green. BSE realty index added 4.5% at 1,885. Capital goods, IT and [pwer shares advanced 1.5-2% each.
Realty and power shares witnessed buying at lower levels after they witnessed a sharp sell off in the previous sessions.
Tata Power and NTPC were up 0.6-1.5% each.
In the realty space DLF was up 4% at Rs 221. Meanwhile, Goldman Sachs downgraded DLF to 'neutral' from 'buy', saying slower approvals could result in fewer project launches, while cutting its pre-sale