Investors also watched higher bond yields, which pressured utilities to fall more than 1 percent as the greatest laggard in the S&P 500.
"Considering the strength of the dollar and the rise in the yields this morning the strength of the (equity) markets is impressive," said Peter Cardillo, chief market economist at Rockwell Global Capital.
Treasury yields pared gains slightly, with the 10-year yield near 2.41 percent, off a session high of 2.42 percent. The 2-year yield held near 0.67 percent after the U.S. Treasury auctioned $26 billion 2-year notes at a high yield of 0.692 percent.
Read More Bond bears back on hopes of Greece deal
The morning's data releases continued to show moderate economic growth, with a greater-than-expected decline in the headline durable goods figure balancing out the best new home sales report since February 2008.
"Bad news isn't good news anymore. Bad news is ok news," said JJ Kinahan, chief strategist at TD Ameritrade. He added that if the S&P 500 fails to break past its record high of 2,130, the index could fall back down to near 2,070, the lower end of its recent trading range.
The Russell 2000 extended gains to hit a new high after also closing at a record on Monday.
"The small caps tend to be a good gauge for the risk-on trade," said Adam Sarhan, CEO of Sarhan Capital. It "supports the notion that more investors are looking to buy stocks."
European stocks closed higher on anticipation of resolution in the Greece debt crisis. Overnight, Japan's blue-chip Nikkei index also hit a 15-year high.
Read MoreGreece close to a deal—so why is the euro falling?
Greece's State Minister Nikos Pappas said on Tuesday in a Reuters report he was confident parliament would back a deal the crisis-hit country hopes to strike with its lenders even though dissenters have criticized concessions offered by Greece.
Separately, Reuters reported that Athens negotiator Euclid Tsakalotos said he believes they are closer to a deal than ever. When asked about the June 30 payment deadline to the International Monetary Fund, he said the deal will enable them to fulfill obligations.
The anti-austerity Greek government presented new budget proposals on Monday, raising hopes that Athens will be able to secure a cash-for-reforms deal with its international creditors. A Greek default and exit form the euro zone could potentially have a negative effect on global markets.
The European Central Bank on Tuesday lifted the ceiling on emergency liquidity to Greek banks for a second time in two days, said Reuters, citing a banking source.
"I do believe Greece and news there in Europe is dictating today," said Nick Raich, CEO of The Earnings Scout. "Make no mistake, if we don't get another 'kick the can down the road' Greece is on the brink of disaster."
In the United States, any further signs that the economic recovery is picking up pace after a tepid first quarter could reinforce expectations for a September rise in U.S. interest rates. Data on Monday showed existing home sales jumped 5.1 percent in May to a 5-1/2 year high. Tuesday's reports continued to indicate strength in the housing market but more moderate growth in the rest of the economy.
The FHFA Housing Price Index showed an increase of 0.3 percent in April. New home sales rose 2.2 percent in May to a more than seven-year high. In another encouraging sign, the Richmond manufacturing index rose to 6 in June, up from 1 in May.
U.S. durable goods data for May showed a decline of 1.8 percent, a greater decline than expected. The core figure of non-defense capital goods orders excluding aircraft rose 0.4 percent, reversing a 0.3 percent decline in April.
"This is an economic recovery but very mixed and fragile," Raich said. "We're seeing that growth is going to pick up in the second quarter but not nearly as much as (the second quarter last year). The durable goods number for me continues to reinforce that."
Growth in the U.S. manufacturing sector moderated in June for a third month in a row, slipping to its slowest pace since late 2013, according to Markit's preliminary U.S. Manufacturing Purchasing Managers' Index.
Federal Reserve Board Governor Jerome Powell said at a Wall Street Journal breakfast that he sees conditions for liftoff as soon as September, followed by a second hike in December, Dow Jones reported. He also said he sees growth around 2 percent this year, with positive signs from the pickup in wages and labor force participation.