Updated with closing stock prices.

Stocks closed slightly to the upside Tuesday after a mixed bag of economic data and earnings, including better-than-expected quarterly performances out of Goldman Sachs ( GS) and Johnson & Johnson ( JNJ).

The Dow Jones Industrial Average rose 27.81 points, or 0.3%, at 8359.49, while the S&P 500 climbed 4.79 points, or 0.5%, to 905.84. The Nasdaq Composite edged up 6.52 points, or 0.4%, to 1799.73.

Home Depot ( HD) and Disney ( DIS) were two of the best performers on the Dow, rising 2.5% and 1.8%, respectively, as consumer discretionary stocks ticked higher.

Intel ( INTC) -- up 2.1% Tuesday -- topped expectations with its quarterly results after the market close and raised its guidance for the current quarter. Intel was up almost 8% in after-hours trading.

The banks led the major indices to a win at the start of the week after Meredith Whitney Advisory Group upgraded Goldman Sachs to buy a day before its quarterly report. Goldman delivered on the bulls' hopes, although there was little buying after Monday's rally. J&J joined Goldman in giving better than expected results, offering some optimism to investors searching for clues on the state of the economic recovery and the tone of unfolding earnings season.

Goldman shares rose 0.2% to $149.66, while J&J tacked on 0.9% to $58.23.

"I think we're beginning to see some hints that the recession is clearly lessening in structural intensity, and we're beginning to see an important picture in a couple of corporations and that is the cost structure is vastly improved and with that profitability is improving," says Michael Strauss, chief economist and market strategist for Commonfund, "and we're beginning to get some of this profit growth without necessarily top line revenue growth."

That may indicate increased efficiency in corporate America, says Strauss, adding that it's one of the things you'd see at a turning point as the economy transitions from negative to less-negative, and eventually to positive, GDP.

(Click below to hear my entire interview with Strauss, including his takeaways from earnings and economic data, and why he expects improvement in the second half of the year.)

Click to Listen
Market Q&A

Stocks initially advanced after the early earnings reports but slunk back after the latest economic data.

The producer price index, the cost of goods at the wholesale level, jumped 1.8% in June, marking the largest increase since November 2007 and well above the consensus estimate of 0.2% growth. Core PPI rose 0.5%, vs. the consensus expectation of a 0.1% decline.

Meanwhile, the Department of Commerce said retail sales rose by a slightly higher than expected 0.6%, and business inventories fell 1%, also slightly more than expected.

Late Monday, Novellus Systems ( NVLS) posted a wider-than-expected second-quarter loss on weakened demand, but also forecast a sharply improved third quarter. CSX ( CSX) also suffered from the weak economy, reporting a 20% decline in second-quarter profit, but the railroad company managed to top Wall Street expectations.

Novellus rose 1.3% to $18.90, while CSX surged 7% higher to $34.80.

 Market Roundup

In other news, Bloomberg reported that the U.S. Justice Department is investigating the market for credit-default swaps, citing Markit Group, the London-based data provider that is majority-owned by Wall Street's largest banks.

Also, the Financial Times reported that Goldman Sachs executives sold almost $700 million worth of stock following the collapse of Lehman Brothers last September.

Elsewhere, crude oil futures closed flat at $59.69 a barrel after gaining more than $1 earlier in the day. Gold rose 30 cents to $922.80 an ounce.

The dollar was stronger vs. the yen and euro, but losing ground against the pound. Longer-dated Treasuries were falling in price, rising in yield. The 10-year was lower by 26/32 to yield 3.45%, while the 30-year lost 1-30/32, yielding 4.35%.

Stocks overseas were mostly higher. In Europe, London's FTSE 100 and the DAX in Frankfurt edged higher by 0.9% and 1.3%, respectively. In Asia, the Nikkei in Japan and Hang Seng in Hong Kong rose 2.3% and 3.7%, respectively.