U.S. Markets closed

Stocks close higher on data, Greece; yield surge pressures utilities

Stocks close higher on data, Greece; yield surge pressures utilities

U.S. stocks closed higher on Wednesday despite a sharp rally in bond yields as investors found encouragement in signs of economic growth and coming resolution in the Greece debt talks. (Tweet This)

"Data's turned a good recovery," said Anthony Valeri, investment strategist at LPL Financial. "Optimism over Greece is helping equities here."

The Federal Reserve's Beige Book said economic activity expanded at a modest to moderate pace, a view affirmed by the morning's data reports on private payrolls, the service sector and trade.

The Dow Jones industrial average closed off its highs, up about 60 points. The Dow transports continued to recover, closing up 1.2 percent.

"I think the market overreacted this morning on the upside while the yield curve was going up and it took its cue from the weaker dollar and the euro stronger on hopes (of Greece), and now reality sets in," said Peter Cardillo, chief market economist at Rockwell Global Capital. "At one point or another as the yield curve continues to strengthen that is a negative effect for equities. They just don't mix."

Read More Bond yields scream higher, give eerie glimpse of future

Earlier, the blue chip index gained more than 150 points and the Nasdaq Composite briefly topped its record close of 5,106.59.

"Here we are near session highs. A lot of it has to do with improved economic conditions and (the idea that) Greece may be close," said Ryan Larson, head of U.S. equity trading at RBC Global Asset Management (U.S.).

Greek Prime Minister Alexis Tsipras agreed in a telephone conversation with German Chancellor Angela Merkel and French President Francois Hollande on the need for an immediate solution involving a lower primary budget surplus target for Greece, a Greek official said in a Reuters report.

Athens warned it could miss a 300 million euro payment due to the International Monetary Fund this Friday.

European stocks closed mostly higher as investors eyed Greece negotiations and unchanged central bank policy.

Read More Greek stocks up as compromise details emerge

At a press conference Wednesday European Central Bank Mario Draghi reaffirmed the continuation of ECB's asset purchase program and said the central bank wants Greece to stay in the euro zone. He would not comment on the Greece debt talks. Earlier in the day, the ECB left the benchmark interest rate unchanged at 0.05 percent, as expected.

The U.S. dollar reversed early gains to fall about half a percent against major world currencies, with the euro topping $1.12.

"On balance the equity market is responding to the sense that the dollar has peaked and will move lower," said John Lonski, chief economist at Moody's. "The global investors hold just under half of Treasury debt. If investors sense dollar softening they're going to demand higher yields from Treasury bonds."

Treasury yields rose following the U.S. data reports and joined the rally in the German Bund yield. The U.S. 10-year hit 2.38, topping both its year-to-date intraday and closing high. The 10-year Bund yield jumped to trade near 0.89 percent, a high for 2015.

The sharp rally in yields sent utilities down more than 1 percent as the worst decliner in the S&P 500. Financials were among the leaders across the major indices.

"Improvement in the 10-year is beneficial (for banks) regardless of the Fed," said Art Hogan, chief market strategist at Wunderlich Securities. "The more second-quarter (data) we see that comes in positive the more we'll see this trend" of rotation in interest-rate sensitive stocks, from utilities into financials.

The S&P Regional Banking ETF (KRE) (NYSE Arca: KRE) jumped more than 1.5 percent to a 52-week intraday high on Wednesday.

"If bond yields move higher it's because bond markets are anticipating better growth in the U.S. economy. That should lead to better corporate profits," said Alan Skrainka, chief investment officer at Cornerstone Wealth Management. "The bond market is anticipating a relatively strong number (on Friday's employment report)."

"A lot of weakness in the first quarter was seasonal factors economists don't quite understand," he said.

Ahead of the highly-anticipated nonfarm payrolls report due Friday, U.S. data continued to show moderate growth in the second quarter.

The ISM non-manufacturing index for May came in at 55.7, nearly a year low. Analysts expected the figure to slip to 57 in May from 57.8 in April. The U.S. Markit PMI Services read for May showed a slight decline from April and came in below expectations at 56.2.

"This week's data should add some clarity to the economic picture, but I doubt it will change anyone's outlook in a material way," James Meyer, chief investment officer at Tower Bridge Advisors, said in a note. "It would appear that any data strength would be too late to change Fed policy in front of June's important FOMC meeting. The odds of a rate increase in June are fairly remote. But an increase in September remains clearly on the table. Solid May data could increase the odds of a rate increase then."

Read More 10 cheap stocks for an overvalued market

ADP private sector payrolls increased 201,000 in May, with the service sector boosting the figure to above the expected 200,000.

The U.S. trade deficit narrowed in April as exports of services hit a record high and imports fell. The U.S. Commerce Department on Wednesday said that the U.S. trade gap shrunk to $40.9 billion in April, the largest decrease since early 2009 and down from March's revised deficit of $50.6 billion.

"We do think there's going to be a bounce back in the second quarter, just not as sharp as it was last year," said Nick Raich, CEO of The Earnings Scout.

The Atlanta Federal Reserve's GDP Model showed the U.S. economy is on track to grow 1.1 percent, up from a 0.8 percent growth projection on Monday.

Chicago Fed President Charles Evans said the fact that Federal Reserve policymakers are talking about possibly raising U.S. interest rates this year signals the progress that has been been made on the economic front, Reuters reported.

However, he said the hurdle for raising U.S. interest rates is "pretty high" at the moment, and in fact it is unlikely the economy will be ready for higher rates before next year.

It is very important to meet the Fed's 2-percent goal on inflation, Evans said. He has stated he does not want to start raising rates until 2016.

The Dow Jones Industrial Average (Dow Jones Global Indexes: .DJI) closed up 64.33 points, or 0.36 percent, at 18,076.27, with Home Depot (HD) and JPMorgan Chase (JPM) leading advancers and Intel (INTC) the greatest laggard.

The S&P 500 (^GSPC) closed up 4.49 points, or 0.21 percent, at 2,114.09, with telecommunications leading seven sectors higher and utilities the greatest decliner.

The Nasdaq (^IXIC) traded up 24 points, or 0.46 percent, at 5,100.

The CBOE Volatility Index (VIX) (^VIX), widely considered the best gauge of fear in the market, traded below 14.

The Russell 2000 gained nearly 1 percent to approach its record close of 1,275.35.

Advancers were a step ahead of decliners on the New York Stock Exchange, with an exchange volume of 608 million and a composite volume of 2.9 billion in the close.

Read More Early movers: EXPE, LNKD, DIS, GES, HPQ & more

Crude oil futures for July delivery settled down $1.62, or 2.64 percent, at $59.64 a barrel on the New York Mercantile Exchange. Gold futures for August delivery ended down $9.50 to $1,184.90 an ounce.

-Reuters contributed to this report.

On tap this week:


4:00 pm: St. Louis Fed President James Bullard on the economy, meets press


8:30 am: Initial claims

8:30 am: Productivity

12:00 pm: Fed Gov. Daniel Tarullo on economy

Earnings: JM Smuckers, Lands End, Joy Global, Ciena, Diamond Foods,Cooper Cos, Verifone


8:30 am: Employment report

12:30 pm: New York Fed President William Dudley on economy, Q&A

3:00 pm: Consumer credit

More from CNBC.com:

More From CNBC