U.S. stocks bounced on Wednesday, closing up more than 1 percent amid signs of encouraging developments in the Greece debt talks and better economic growth as yields continued to rally. (Tweet This)
All blue chips gained and all S&P sectors advanced as the major averages recovered from recent losses.
"It's really been Greece. There was a real sense they're just going to let it go, and now we're at the 11th hour and now it looks like a deal is going to come together at the last minute," said Alan Skrainka, chief investment officer at Cornerstone Wealth Management.
The Dow Jones industrial average briefly extended gains to trade 280 points higher as traders cheered a Bloomberg report that Germany is said to consider offering Greek Prime Minister Alexis Tsipras aid in return for committing to one economic reform, sources familiar with Germany's position told the news service. CNBC was unable to confirm this report.
In response, a government spokesman told Reuters that Germany will only accept a deal between Athens and its creditors if it has the approval of all three lending operations.
"The catalyst is Greece," Jack Ablin, chief investment officer at BMO Private Bank said, referring to the late-morning 50-point jump in the Dow. "We're seeing Europe lead the equity charts higher but I also find it encouraging that equities can gain ground while interest rates are rising."
Read MoreFund pros dump government bonds
"The fact is that the fundamental underpinnings of the market may be sound," he said. Higher bond yields raise expectations of increase rate hike, which Ablin said is preferable for both the market and investors.
Traders also noted short covering in Wednesday's broad-based stock rally, which sent the major averages up more than 1.2 percent.
Earlier, the blue chip index gained more than 200 points in morning trade to swing back into positive territory for the year, up about 1 percent for 2015. The major averages rebounded from recent lows. The Dow transports also recovered, closing up 0.7 percent as most of the airlines gained back some losses. The index remains at correction levels.
"I really believe fundamentals drive markets and fundamentals in the U.S. are coming back," said Doug Cote, chief market strategist at Voya Investment Management.
The Treasury Department auctioned $21 billion of 10-year notes at a high yield of 2.461 percent. The 10-year yield traded near 2.48 percent after earlier hitting an 8-month high of 2.495 percent. The morning rally followed gains in the German 10-year bund yield to above 1 percent for the first time since Sept. 25, 2014, as investors found signs of improvement in European economic data.
"Improved macroeconomic data globally should go hand-in-hand with selling in Treasurys and increases in yields," said Art Hogan, chief market strategist at Wunderlich Securities.
"Sadly this quiet move higher (in equities) is being done at pretty low volume," he said.
The bund yield pared gains to hold near 0.98 percent. Major European stock indices closed higher on hopes of resolution in Greece, with the German DAX surging 2.4 percent to recover slightly from correction territory. The ATHEX Composite fell 1 percent.
Information technology led sector gains, up 1.6 percent for the day. Tech stocks are down 0.75 percent year-to-date.
Gains in oil boosted energy more than 1 percent to trade among the leaders in the S&P 500. Chevron was among the blue chip leaders as all the stocks in the index advanced. Crude oil settled higher, up $1.29, or 2.14 percent, at $61.43 a barrel as the weekly inventory report indicated U.S. production is leveling off.
Phil Flynn, energy market analyst at Price Futures Group, said a close above $61 sets oil up for gains. His near-term target is $65.
"What we're seeing is signs output peaked and demand picking up," he said. "When you see the technicals and fundamentals getting there it looks bullish."
The euro hit a three-week high above $1.13 on Wednesday, while the dollar fell to a two-week low against the yen after Bank of Japan Governor Haruhiko Kuroda said the real effective exchange rate showed the Japanese currency is "very weak".
Asian stocks closed mostly lower, with Chinese stocks pressured by MSCI's decision to delay the addition of Chinese A-shares to the benchmark MSCI emerging market index.
In U.S. economic news, total weekly mortgage applications, showed an 8.4 percent jump on a seasonally adjusted basis as buyers rushed to get mortgages ahead of rising rates.
"Today is a little setting up for the retail sales number (tomorrow)," said JJ Kinahan, chief strategist at TD Ameritrade. He is watching for pickup in the ex-autos and ex-gasoline figure.
"I think people are expecting a better number based on the jobs number and wage growth," he said.
A minor data release indicated the first quarter was probably not as weak as reported, Reuters said. The Commerce Department's quarterly services survey, or QSS, showed consumption, including healthcare spending, increased at a faster clip than the government had assumed in its second estimate of gross domestic product published last month.
The United States Treasury Department reported a budget deficit of $82.4 billion in May, a 37 percent drop from the same period last year, Reuters said.
"Before the Fed meeting (next Tuesday and Wednesday) there's a dearth of (market-moving) economic data," said Adam Sarhan, CEO of Sarhan Capital. "Until we get to next Wednesday I think techincals are front and center."
He's watching for the S&P 500 to hold above yesterday's low of 2,072 and close near or above its 50-day moving average.
"If (bulls) don't show up today and buy the dip, when will they?" he said. "If we open higher and close lower, that's a bad sign, no doubt about it."
The Dow Jones industrial average closed above 18,000 for the first time in the last five trading sessions. The S&P 500 closed above its 50-day moving average and held within its month-long range of 2,070 and 2,130. Both indices had their best day since May 8.
"A bounce is unfolding among global equity markets this morning in reaction to widespread short-term oversold conditions," BTIG Chief Technical Strategist Katie Stockton said in a note. "This is a bullish development, but we would like to see a strong finish to the week to confirm oversold 'buy' signals."
The closed up 25.05 points, or 1.20 percent, at 2,105.20, with information technology leading all 10 sectors higher.
The Nasdaq closed up 62.82 points, or 1.25 percent, at 5,076.69.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded near 13.
About three stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 768 million and a composite volume of 3.3 billion in the close.
Gold futures for August delivery settled up $8.80 at $1,186.60 an ounce.
In corporate news,
Netflix closed up 3.7 percent to a record after news its shareholders approved an increase in the company's share authorization, the precursor to a stock split. There's no indication yet for an exact ratio for the split.
Apple gained 1.1 percent despite reports its newly announced Apple Music service is facing antitrust scrutiny from the attorneys general of New York and Connecticut. The probe will center on Apple's negotiations with music companies on its paid subscription service.
—CNBC's Peter Schacknow contributed to this report.
On tap this week:
Earnings: Box, Krispy Kreme, Men's Wearhouse
Earnings: Restoration Hardware, Korn Ferry, Casey's General, ExOne
8:30 a.m.: Initial jobless claims, retail sales, import prices
10 a.m.: Business inventories
10:30 a.m.: Natural gas inventories
1 p.m.: $13 billion 30-year bond auction
8:30 a.m.: PPI
10 a.m.: Consumer sentiment
More From CNBC.com: