The S&P 500 jumped back above a six-month trend line after closing just below it on Monday. Holding this level is a sign of strength, but traders will grow wary the more it is tested.
Similarly, the Nasdaq composite index rallied from its 50-day moving average in another indication of an uptrend, although trading volume was lackluster.
"The fact that the market has held up so well in the face of one of the sharpest crude oil spikes in years is a testament to that underlying strength," said Richard Ross, global technical strategist at Auerbach Grayson in New York.
Bank of America Corp (BAC.N) shot up 4.7 percent to $14.69 after it forecast pretax profit of about $40 billion annually longer term, higher than some investors had expected.
Financial shares led gainers, with the S&P financial index (.GSPF) up 2.2 percent.
Oil prices pulled back, with Brent crude down nearly 2 percent at $113.06 a barrel after Kuwait's oil minister said OPEC was in discussions to increase production.
The Dow Jones industrial average (.DJI) gained 124.58 points, or 1.03 percent, to 12,214.61. The Standard & Poor's 500 Index (.SPX) added 11.69 points, or 0.89 percent, to 1,321.82. The Nasdaq Composite Index (.IXIC) rose 20.14 points, or 0.73 percent, to 2,765.77.
The S&P has advanced more than 25 percent since a rally started in September. On Tuesday the index moved back above a trendline that connects lows in late August and late November.
Auerbach's Ross said crude prices may not "be super far away" from a level that could force a correction, but a pullback to support at 1,280 on the S&P 500 may be a good time to buy.
"If we got a test of 1,280 that held I think that would be an outstanding entry point," he said.
Another technical indication of the market's resilience was the Nasdaq's keeping above its 50-day moving average.
"We are back above that level today, but we need to see it get a percentage or two above or below before we view it as the market breaking one way or the other," said Paul Hickey, an analyst at Bespoke Investment Group in Harrison, New York.
Turmoil in Libya and unrest in the region had driven up oil prices to 2 1/2-year highs before the talk of OPEC considering a production boost.
Bruce Zaro, chief technical strategist at Delta Global Asset Management in Boston said a major selloff in oil and reduced worries about supply could be the catalyst to push stocks out of their recent range.
A break above 12,300 on the Dow would be significant and could mean further gains, he said.
Stocks have been closely tied to oil prices recently as investors worry that consumer spending may be curtailed by higher oil and gasoline prices, choking off an economic recovery.
Hank Smith, chief investment officer at Haverford Trust Co. in Philadelphia, said his firm was overweight on the energy sector, which has helped to offset some of the market decline following the Libyan unrest.
Helping homebuilders, Credit Suisse upgraded MDC Holdings Inc (MDC.N) , saying it expects the homebuilder to show improved operating results in 2011. The stock rose 11.1 percent to $27.55.
The Dow Jones homebuilders index (.DJUSHB) rose 4.9 percent. PulteGroup Inc (PHM.N) jumped 8.4 percent to $7.09.
On the negative side, shares of online rental service Netflix Inc (NFLX.O) fell 6.8 percent at $195.45 after Warner Bros Digital Distribution said it would make some of its films available on Facebook.
Netflix has been among the market's top performers in the recent rally and risen 56 percent since the start of September.
Combined volume on the NYSE, Nasdaq and Amex was 7.57 billion, below last year's daily average of 8.47 billion.
Advancing stocks outpaced declining stocks on the NYSE by a ratio of about 3 to 1 while five stocks rose for every two that fell on the Nasdaq.
(Additional reporting by Rodrigo Campos and Caroline Valetkevitch; Editing by Kenneth Barry)
Visit View Best in The word for Daily Updated Animal Funny Pictures Collection