U.S. stocks closed more than 1 percent higher in light volume trade Monday, following gains overseas on news of a bailout agreement between Greece and its creditors. (Tweet This)
"I think it's just a sigh of relief that it's over, but let's face it, they just kicked the can," said Maris Ogg, president of Tower Bridge Advisors. "It seems like we kicked the can on a number of fronts. Earnings probably will be front and center int he next couple of weeks."
About 11 stocks advanced for every 4 decliners on the New York Stock Exchange, with an exchange volume of 737 million and a composite volume of near 3.1 billion in the close. Average volume for the entire day is 3.4 billion.
"You've got a relief going on, short covering going on," said Quincy Krosby, market strategist at Prudential Financial. "What you want for confidence buying is to see a market close with buying orders on the close."
Both the Dow and Nasdaq closed above their 50-day moving averages for the first time since June.
The Dow Jones industrial average closed about 217 points higher, with Microsoft and DuPont leading most blue chips higher. The index recovered recent losses to hold nearly 0.9 percent higher for the year.
The S&P 500 hit 2,100 but closed just below it. Boosting the index was a rise in information technology stocks and consumer discretionary's 1.47 percent gain to an all-time high.
The Dow transports also advanced more than 1 percent, with airlines leading gains.
"I think the market's technically very oversold," said Bruce Bittles, chief investment strategist at RW Baird. "The market's poised to go up but to break this trading range (we've been in) since January you need to see volume pick up... number of stocks hitting 52-week highs expand."
He said the S&P 500 breaking past 2,100 would be an encouraging sign.
European Council President Donald Tusk said early on Monday that euro zone leaders reached an unanimous agreement with Greece after all-night talks in Brussels to move forward with a bailout loan for the cash-strapped nation, provided Athens implement tough reforms.
"The jury's still out on whether or not this is going to be accomplished," said Mark Luschini, chief investment strategist at Janney Montgomery Scott.
To receive this third bailout, Greece's parliament must pass the new rules in areas such as privatization, labor laws and pension reforms by Wednesday. The 86 billion euro ($95.2 billion) in funds would come over three years.
In the meantime, euro zone finance ministers were expected to discuss Monday how to keep Greece financed before the bailout deal is reached. Athens faces a 7 billion euro repayment deadline on July 20 to the European Central Bank.
The ECB announced it maintains the emergency assistance cap for Greek banks, which will remain closed for at least two more days.
The Dow Jones industrial average futures were about 140 points higher before the open.
European stocks jumped on news of the conditional Greece deal, with the German DAX up about 1.5 percent and the STOXX Europe 600 up nearly 2 percent
In Asia, stocks surged with the Nikkei up 1.57 percent and the Shanghai Composite leaping 2.4 percent as it extended a recovery from a recent plunge.
Art Hogan, chief market strategist at Wunderlich Securities, said the domestic response will likely be less exuberant since the major averages ended last week little changed. Only the Dow eked out a gain, of a mere 0.17 percent.
Stocks rose slightly past their opening levels, while bond yields held steady. The U.S. 10-year note yield was 2.44 percent and the held near 0.67 percent. The German 10-year bund yield fell to 0.85 percent.
The U.S. dollar extended gains with the euro dipping below $1.10.
Also in focus is the Iranian nuclear deal, which would allow more oil exports. Talks on a deal were extended past a June 30 deadline and are expected to reach a conclusion Monday.
Crude oil futures settled down 54 cents, or 1.02 percent, at $52.20 a barrel on the New York Mercantile Exchange. Gold futures settled down $2.50 at $1,155.40 an ounce.
No economic data or earnings of note were expected Monday.
"Each data point in and of itself may not be important, but collectively they're important, especially since there's a premium on the data," Krosby said.
Federal Reserve Chair Janet Yellen delivers her semi-annual testimony on the economy to Congress on Wednesday and Thursday.
"If she focuses on (international news and the dollar) that will give the market a huge boost because she's more concerned about it than she suggested in her speech Friday," Krosby said.
In other news, the United States posted a budget surplus of $51.8 billion in June, down 27 percent from the same period last year, the U.S. Treasury Department said on Monday.
The Dow Jones Industrial Average closed up 217.27 points, or 1.22 percent, at 17,977.68, with DuPont leading advancers and Merck the only decliner.
The closed up 22.98 points, or 1.11 percent, at 2,090.60, with information technology leading 10 sectors higher.
The Nasdaq closed up 73.82 points, or 1.48 percent, at 5,071.51.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded just below 14.
—Reuters contributed to this report.
On tap this week:
Earnings: JPMorgan Chase, Wells Fargo, Johnson and Johnson, CSX, Yum Brands, Fastenal, Commerce Bancshares
6:00 a.m.: NFIB small-business survey
8:30 a.m.: Retail sales
8:30 a.m.: Import prices
10:00 a.m.: Business inventories
8:15 p.m.: Kansas City Fed President Esther George
CNBC's Delivering Alpha conference
Earnings: Bank of America, BlackRock, US Bancorp, Delta Air Lines, PNC Financial, Intel, Netflix, ASML Holding, Wintrust Financial
8:30 a.m.: PPI
8:30 a.m.: Empire State survey
9:15 a.m.: Industrial production
10:00 a.m.: Fed Chair Janet Yellen semiannual testimony before House Financial Services
12:25 p.m.: Cleveland Fed President Loretta Mester on economic outlook
2:00 p.m.: Beige book
3:00 p.m.: San Francisco Fed President John Williams on outlook
Earnings: Citigroup, Goldman Sachs, Google, Sclumberger, Advanced Micro, Philip Morris, UnitedHealth, Blackstone, Charles Schwab, KeyCorp, Sherwin-Williams, Taiwan Semiconductor, Domino's Pizza, Mattel
8:30 a.m.: Initial claims
10:00 a.m.: Philadelphia Fed survey
10:00 a.m.: NAHB survey
2:30 p.m.: Fed Chair Yellen semiannual testimony before Senate Banking Committee
4:00 p.m.: TIC data
Earnings: General Electric, Honeywell, Kansas City Southern, JB Hunt, Synchrony Financial, WW Grainger
8:30 a.m.: CPI
8:30 a.m.: Housing starts
10:00 a.m.: Consumer sentiment
More From CNBC.com: