Coca-Cola rose 4 per cent after reporting higher sales of non-carbonated beverages. Johnson & Johnson rose 2 per cent after its income rose.
Toll Brothers and other homebuilders fell after a measure of the industry's confidence in the housing market remained low. Apple and Netflix also fell.
Major U.S. indexes moved between gains and losses all day before ending slightly higher.
The Standard & Poor's 500 index rose 12 points, or 0.7 per cent, to close at 1,842 Tuesday.
The Dow Jones industrial average gained 89 points, or 0.6 per cent, to 16,262. The Nasdaq added 11 points, or 0.3 per cent, to 4,034.
Bond prices rose. The yield on the 10-year Treasury note fell to 2.62 per cent.