Investors continued to pay close attention to unstable regions abroad, and while violence persisted in the Gaza Strip, hopes rose for an easing of tension in Ukraine.
Verizon Communications Inc VZ.N rose 0.6% to $50.98 after the company reported revenue that topped expectations.
Chipotle Mexican Grill CMG.N was the S&P 500's biggest%age gainer, up 11.8% at $659.77 a day after the burrito chain reported a steep jump in profit.
Netflix Inc, one of the market's biggest trading favorites over the past few years, reported a quarterly profit that more than doubled on Monday after the market closed. However, on Tuesday, Netflix shares fell 4.6% to $431.09 as the company's plans to expand in Europe were seen as eroding profits.
With 23% of S&P 500 companies having reported results, 66.1% posted earnings that topped expectations, according to Thomson Reuters data, above the long-term average of 63%. More than 64% have beaten revenue forecasts, above the long-term average of 61%.
"So far earnings have been pretty robust, better than a lot of people were looking for, including on the forward guidance side," said William Greiner, chief investment officer at Mariner Wealth Advisors in Leawood, Kansas. "There are some concerns about valuation, but stocks remain a more attractive asset class than bonds."
More From This Section
After the closing bell, Microsoft Corp MSFT.O reported a rise in revenue, though earnings fell in part due to the effect of incorporating the handset business of Nokia, which it acquired in April.
Microsoft's stock was flat at $44.83 in extended-hours trading.
Apple Inc reported third-quarter earnings that topped expectations, though revenue missed forecasts. Apple's stock initially fell in after-hours trading, though it subsequently turned higher, rising 0.3% to $95.
During Tuesday's regular session, homebuilders' stocks represented one of the strongest sectors. The housing index gained 1% after data showed that existing home sales hit an eight-month high in June. D.R. Horton Inc rose 1.9% to $24.30 while Beazer Homes advanced 2% to $19.21.
The US Consumer Price Index rose in June, although the overall trend pointed to a slow buildup of inflation pressures, conditions that could allow the US Federal Reserve to keep gradually easing its stimulus programs.
The Dow Jones industrial average .DJI rose 61.81 points or 0.36%, to end at 17,113.54. The S&P 500 gained 9.90 points or 0.50%, to 1,983.53. The Nasdaq Composite added 31.31 points or 0.71%, to 4,456.02.
The S&P 500 hit an intraday record high just above 1,986, the latest in a series of such records. Equities have been strong in 2014, with July on track to be the S&P 500's sixth straight monthly advance.
Abroad, pro-Russian rebels agreed to hand over the black boxes from the Malaysian Airlines plane shot down last week near the Ukraine-Russia border and the Malaysian government negotiated the release of the remains of nearly 300 victims.
Traders also kept an eye on the Middle East as Israel pounded targets across the Gaza Strip and said no cease-fire was near. Top US and U.N. diplomats pursued talks to stop fighting that has claimed more than 600 lives, an overwhelming majority from inside Gaza.
"We're worried about the situation in Gaza and Ukraine, but it is hard to put a dollars-and-cents amount to it," said Greiner, who helps oversee $33 billion in assets. "It's important, but more of a sentiment issue."
In other earnings news, United Technologies Corp shares fell 1.9% to $110.86 despite the company's strong outlook. Coca-Cola Co dropped 2.9% to $41.19 after the soft drinks company's sales missed estimates. The Travelers Companies Inc shares dropped 3.8% to $91.63 after hail and wind storms in the United States increased the insurer's catastrophe losses. All three companies are Dow components.
Billionaire activist investor William Ackman's latest volley of accusations against Herbalife HLF.N fell flat on Wall Street, with the nutrition company's shares soaring 25.5% to $67.77.
About two-thirds of the stocks traded on the New York Stock Exchange closed higher for the day while about 65% of Nasdaq-listed shares closed in positive territory.
About 5.05 billion shares traded on all US platforms, according to BATS exchange data, below the month-to-date average of 5.56 billion.