The stock market posted gains today after four straight days of declines. The Nifty closed above 25,100 today.