Energy and materials stocks, which have been battered recently as commodities prices sank, fared slightly better than the rest of the market.