The Dow Jones industrial average rose 17.38 to 5,711.27, reversing direction after two days of losses.
Advancers led decliners by 8 to 5 on the New York Stock Exchange, with 1,432 up, 893 down and 878 unchanged.
NYSE volume totaled 306.35 million shares vs. 281.38 million traded yesterday.
Broad-market issues also were higher. The NYSE composite rose 1.26 to 357.15, and the S&P 500 gained 2.51 to 666.39.
The Nasdaq composite advanced 7.62 to 1,146.84, and the American Stock Exchange's market value index rose 1.43 to 562.05.
Both stocks and bonds opened stronger but dipped after the Conference Board reported that its Consumer Confidence Index rose 2.4 points to 109.4 this month after rising 7 points in July. Most economists had expected a decline to about 105.
Investors worry that a consistent stream of robust economic data will prompt the Federal Reserve to raise interest rates.
Bonds fell after today's report, pushing up the yield of the benchmark 30-year Treasury bond to 6.99 percent. It later recovered to end the day up 3/8, lowering its yield 3 basis points to 6.97 percent.
Stocks were firmer but moving on a name-by-name basis. PepsiCo led the most-actives on the Big Board, falling 62-1/2 cents to $31.
Philip Morris, a Dow component, was up $1.37-1/2 at $91.75, extending yesterday's gains.