U.S. stocks managed modest gains on Tuesday as better-than-expected corporate profits overshadowed concerns about weak consumer demand.

Positive surprises on the earnings front could boost markets again on Wednesday as chip maker Intel reported results after the bell that surpassed expectations, driving stock index futures sharply higher.

Intel also gave a forecast for current-quarter revenue that beat analysts' estimates. Its stock surged 7.4 percent to $18.08 in extended trade.

Analysts said the bulk of Tuesday's news during the regular session, including a jump in profit from Goldman Sachs , was already accounted for on Monday, when major stock indexes climbed more than 2 percent in anticipation of strong bank results.

Competing positive and negative earnings reports tempered each other, keeping the markets range-bound.

Gains were muted by lackluster retail sales data and comments from Dell that second-quarter margins would be lower as demand has shifted toward cheaper computers, such as netbooks.

This was offset by encouraging comments from railroad company CSX Corp's chief executive and results from Johnson & Johnson that surpassed expectations.

The sellers had a chance to run with it, but again we found sideline cash ready to come in, said Scott Marcouiller, senior equity market strategist at Wells Fargo Advisors in St. Louis.

The bottom line is, we think we're still going to be in this trading range for a little while longer.

The Dow Jones industrial average <.DJI> added 27.81 points, or 0.33 percent, to 8,359.49. The Standard & Poor's 500 Index <.SPX> gained 4.79 points, or 0.53 percent, to 905.84. The Nasdaq Composite Index <.IXIC> rose 6.52 points, or 0.36 percent, to 1,799.73.

Data showed June retail sales increased 0.6 percent, which was more than forecast, but a big part of that gain was due to rising gasoline prices. Excluding autos and gas sales, retail sales registered a fourth consecutive monthly decline.

A rebound in sales is considered vital for the U.S. economy to bounce back from recession, as consumer spending accounts for roughly two-thirds of the country's economic activity.

GOLDMAN GAINS, BUT DELL DIVES

Goldman Sachs Group's surge in quarterly profit handily beat expectations, but its stock gained just 0.2 percent to $149.66 after Monday's jump of 5 percent.

Johnson & Johnson's profit also surpassed forecasts and the Dow component rose 0.9 percent to $58.23.

The current earnings season is under particular scrutiny as investors look for signs of economic improvement.

Indeed, comments from the chief executive of CSX that the worst of the recession seems to be over helped bolster stocks.

CSX, which reported better-than-expected results after Monday's closing bell, saw its shares climb 7 percent to $34.80 on the New York Stock Exchange. The Dow Jones Transportation Average <.DJT> gained 1.3 percent.

But personal computer maker Dell limited gains after its lower margin forecast, pushing its stock down 8.1 percent to $11.97 on Nasdaq.

Volume was light on the New York Stock Exchange, with only about 979 million shares changing hands, sharply below last year's estimated daily average of 1.49 billion, while on the Nasdaq, about 1.91 billion shares traded, below last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of about 7 to 3, while on the Nasdaq, about 15 stocks rose for every 11 that fell.

(Editing by Jan Paschal)