US stocks had ended sharply higher on Tuesday, breaking a five-day losing streak, as attention shifted from trouble in Chinese equities to US corporate earnings and to speculation the first Federal Reserve interest rate hike may not come until December.

The Dow Jones industrial average and S&P 500 chalked up gains of more than 1 per cent, while the Nasdaq Composite lagged slightly.

After the S&P sank over the past week towards the low end of a range it has traded in since February, some investors wagered the market was primed for a technical bounce-back.

"The S&P has had five down days in a row and a lot of people are starting to nibble," said Michael Matousek, head trader at U.S. Global Investors Inc in San Antonio, which manages about $1 billion.

Market sentiment also reflected expectations the Fed would wait until December, rather than September, to raise interest rates for the first time since 2006, Matousek added.

With a two-day Fed policy meeting ending on Wednesday, investors are looking for hints about the timing of that rate increase. No move on rates is expected this week.

"September is possible but the probability for a December rate hike is increasing," said Terry Sandven, chief equity strategist at US Bank Wealth Management in Minneapolis.

The Dow Jones industrial average rose 1.09 per cent to end the session at 17,630.27. The S&P 500 gained 1.24 per cent to 2,093.25 and the Nasdaq Composite added 0.98 per cent to finish at 5,089.21.

All the 10 major S&P 500 sectors rose, with the energy index leaping 2.99 per cent as oil prices recovered from near six-month lows.

US consumer confidence weakened in July to its lowest level since September, due in part to a less optimistic outlook on the labour market.

Ongoing uncertainty related to China's stock market, which closed lower again on Tuesday, took a backseat to US corporate earnings.

With second-quarter reports well under way, analysts now expect overall earnings of S&P 500 companies to edge up 0.3 per cent and revenue to decline 4.0 per cent, according to Thomson Reuters data.

"Earnings are growing but very slowly. The market's biggest concern is the lack of top-line growth and where that growth is going to come from," said Tim Courtney, chief investment officer of Exencial Wealth Advisors, which oversees $1.3 billion.

After the bell, Twitter jumped 5.2 per cent and Gilead Sciences rose 3 per cent after both companies posted their second-quarter results. Yelp slumped 13 per cent after its report.

During Tuesday's session, SuperValu jumped 10.60 per cent. It said it was exploring a spinoff of its discount grocery chain Save-A-Lot into a publicly-traded company.

Advancing issues outnumbered declining ones on the NYSE by 2.7 to 1. On the Nasdaq, 1.67 stocks gained for each that declined.

The S&P 500 racked up 15 new 52-week highs and 12 lows. The Nasdaq Composite posted 36 new highs and 163 lows.

Some 7.3 billion shares changed hands on US exchanges, above the daily average of 6.7 billion so far this month.