An upbeat profit forecast from Bank of America and a pullback in oil prices lifted Wall Street out of the technical danger zone on Tuesday in another sign of the market's near-term resilience.

The S&P 500 jumped back above a six-month trend line after closing just below it on Monday and the Nasdaq rallied from its 50-day moving average. Holding those levels is a sign of strength, but traders will grow wary the more they are tested.

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.

Bank of America Corp shot up 4.4 percent to $14.64 after it forecast pretax profit of about $40 billion annually longer term, which was 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.16 a barrel after Kuwait's oil minister said OPEC was in discussions to increase production.

The Dow Jones industrial average <.DJI> gained 124.88 points, or 1.03 percent, to 12,214.91. The Standard & Poor's 500 Index <.SPX> rose 10.56 points, or 0.81 percent, to 1,320.69. The Nasdaq Composite Index <.IXIC> added 16.87 points, or 0.61 percent, to 2,762.50.

The S&P 500 moved above a trend that connects lows in late August and late November.

Turmoil in Libya and unrest in the region have driven up oil prices to 2 1/2-year highs recently.

The market is still trying to deal with the turmoil in the Mideast, and (with) any kind of pullback in oil prices, we've seen the effect where the market has jumped rather significantly, said Bruce Zaro, chief technical strategist at Delta Global Asset Management in Boston.

Zaro 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 worried that consumer spending may be curtailed by higher oil and gas prices, choking off an economic recovery.

The S&P has advanced about 25 percent since a rally started in September.

On Tuesday, Libyan warplanes struck at rebel forces, stepping up government efforts to roll back early gains in the revolt against Muammar Gaddafi.

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.

On the negative side, shares of online rental service Netflix Inc were down 6 percent at $194.87 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 has risen 56 percent since the start of September.

(Additional reporting by Rodrigo Campos and Caroline Valetkevitch; Editing by Kenneth Barry)