The Dow and the S&P were slightly higher on Tuesday as two days of heavy selling provided buying opportunities, but continuing debt worries kept investors on edge.

Banks and energy stocks helped offset losses that came at the market's open and before regular trading when stock index futures slid. Tech shares weighed heavily on the Nasdaq.

In the very short-term basis, we've gotten extremely oversold after two days of losses. The fact that the (futures) market stabilized earlier on rumors and no tangible news shows how oversold we are, said James Dailey, portfolio manager at TEAM Asset Strategy Fund in Harrisburg, Pennsylvania.

This is a technical rebound and by no means is the selling over.

Traders cited rumors that the European Central Bank was buying peripheral paper as fears that the euro zone's debt crisis was spreading pummeled world markets.

The Dow Jones industrial average <.DJI> was up 28.72 points, or 0.23 percent, at 12,534.48. The Standard & Poor's 500 Index <.SPX> was up 3.37 points, or 0.26 percent, at 1,322.86. The Nasdaq Composite Index <.IXIC> was down 1.80 points, or 0.06 percent, at 2,800.82.

On Monday stocks posted their worst day in a month.

The Nasdaq underperformed other indexes as chipmakers fell sharply after Novellus Systems Inc said it expects bookings to continue to fall as chipmakers curb capacity. Novellus fell 10.1 percent to $32.16. The SOX semiconductor index <.SOX> fell 2.3 percent.

The CBOE Volatility Index <.VIX>, Wall Street's fear gauge, rose 5.3 percent, reflecting sentiment that sent equities around the world into a slide.

The level of nervousness in the market has certainly grown. We are looking for resolutions, but we're only getting a lot of chatter, said Stephen Massocca, managing director at Wedbush Morgan in San Francisco.

European officials for the first time refused to rule out default by Greece and investors feared the crisis could overtake the bigger European economies of Spain and Italy.

Helping support markets, traders cited rumors that the ECB was buying peripheral bonds for the first time in three months, with Portugal the suspected target.

The euro stumbled to an all-time low against the Swiss franc on Tuesday as euro zone government bond yields vaulted higher, prompting investors to dump the single currency for safer ones.

The U.S. corporate earnings season, which Alcoa Inc kicked off on Monday, is widely expected to be good and could provide some counterbalance to the troubles engulfing the euro zone.

Alcoa shares rose slightly to $15.95 one day after the aluminum producer and Dow component posted a big jump in second-quarter profit.

(Reporting by Angela Moon, Editing by Kenneth Barry)