U.S. stocks mostly edged higher on Tuesday after growing optimism the Federal Reserve will soon make another cut in interest rates offset warnings from two leading retailers and weak economic data.

The price of U.S. crude oil dropped below $80 a barrel, helping shares of big manufacturers such as plane maker Boeing Co and diversified manufacturer United Technologies Corp with the promise of lower energy costs.

The negative tone for Tuesday's opening was set late on Monday when home improvement chain Lowe's Cos Inc gave a profit warning and Target Corp said it would fall short of its September sales forecast.

Adding to the market's woes, data showed consumer confidence sank unexpectedly to nearly a two-year low in September, while another report said the pace of U.S. existing home sales fell last month.

Even though the reports provided more evidence that the worsening housing market was having a broader impact on the economy, they also supported the view that the Fed would cut rates again at its October policy meeting.

Prospects for the economy have darkened modestly because of these (economic) numbers, but the good news in the minds of some investors is this improves the probability the Federal Reserve will lower rates further, said Hugh Johnson, chief investment officer of Johnson Illington Advisors in Albany, New York. Lower interest rates are seen as making money cheaper to borrow, spurring capital investment and economic growth.

The Dow Jones industrial average gained 19.59 points, or 0.14 percent, to finish at 13,778.65. The Standard & Poor's 500 Index dropped 0.52 points, or 0.03 percent, to 1,517.21. The Nasdaq Composite Index gained 15.50 points, or 0.58 percent, to 2,683.45.

Technology outperformed other sectors, with Apple Inc. leading gains on the Nasdaq. Some investors see the technology sector as one of those least affected by weakness in the housing market. Apple ended up 3.3 percent at $153.18 on the Nasdaq.

Boeing rose 1.8 percent to $104.93, while United Technologies advanced 1.6 percent to $79.93, both on the New York Stock Exchange.

On the New York Mercantile Exchange, crude oil settled down $1.42, or 1.8 percent, at $79.53 per barrel as oil and natural gas production in the Gulf of Mexico was near full recovery from weather-related shutdowns.

Following their reports on Monday, Target shares fell 4.6 percent to $61.35 while Lowe's ended down 6.7 percent at $28.51. The S&P retail index declined 2.7 percent.

I think everybody is stunned by some of the retail information, said Cummins Catherwood, managing director at Rutherford, Brown & Catherwood in Philadelphia. There's a caution in the air, but they're not all running and hiding.

While the National Association of Realtors said the pace of U.S. existing home sales fell last month, the annualized level was slightly above economists' expectations.

Lennar Corp, the No. 2 U.S. home builder, reported its worst-ever quarterly results as the crumbling U.S. housing market led to a much wider-than-expected loss, sending its shares down to $22.50, a five-year low. The stock ended down 4 percent at $23.22.

The Dow Jones index of home construction companies dipped 2.4 percent to 354.14.

The Conference Board, a private group, said its index of consumer sentiment fell last month on growing concerns about jobs and financial market turmoil and was at its lowest since November 2005.