US Markets

Stocks close well off highs on continued China, Greece concerns

Greece worries the Fed
VIDEO2:1702:17
Greece worries the Fed
Cashin: Painful, but right decision by NYSE
VIDEO1:4801:48
Cashin: Painful, but right decision by NYSE
Should you fear China's market?
VIDEO2:3102:31
Should you fear China's market?
NYSE's shutdown... the morning after
VIDEO2:1002:10
NYSE's shutdown... the morning after

U.S. stocks closed mildly higher on Thursday, giving back more than half of opening gains as investors remained cautious on China and Greece. (Tweet This)

"I think the market's really much in a 'wait-and-see' mode on Greece and China," said Paul Nolte, portfolio manager at Kingsview Asset Management. We want to see "if there's more to the rally than last night's bounce."

The Dow Jones industrial average closed about 30 points higher after surging as much as 249 points in the open as the major averages briefly jumped nearly 1 percent or more.

Overnight, the Shanghai Composite shot 5.8 percent higher for its best day in six years after China instituted new supportive measures, including restrictions on short selling and loosening of margin lending regulations.

Stocks followed Chinese and European rally in the open but pared gains throughout the day as optimism over the China bounce faded.

"It's an underlying sense that the market is getting weaker, not stronger," said Adam Sarhan, CEO of Sarhan Capital. "The market's been drifting lower ever since the open. (There's a) lack of a bullish catalyst."

The Nasdaq outperformed as the iShares Nasdaq Biotechnology ETF (IBB) ended more than 1 percent higher.

The S&P 500 briefly swung back into positive territory for the year but failed to hold gains, ending about 0.4 percent lower for the year and the Dow off 1.5 percent for 2015.

"The things we're concerned about we're still concerned about," said Art Hogan, chief market strategist at Wunderlich Securities.

"I don't think we should have the same causal relationship but at least for today in a market that's oversold, having a bounce in Asian markets is going to" give us a bounce in the U.S.," he said earlier.

Read More Goldman: US investors need a 'staycation'

"You had that morning rush, and you want that type of spike (right) off the gate. That means you have more of those spikes from short sellers covering," said Peter Cardillo, chief market economist at Rockwell Global Capital. "Unless we get some real news—Greece proposals not sufficient to get emergency loans—we'll probably rebound towards the higher end of today's trading range."

The Greek government was expected to submit reform proposals by midnight Thursday. A government source told Reuters that Athens will ask for parliament's approval on Friday to negotiate on the text of "prior actions" that could form the basis of a cash-for-reforms deal with creditors.

European stocks also surged, with the DAX closing up more than 2 percent, as investors remained hopeful of a Greece proposal before the Friday deadline.

Read MoreReform proposal in 'next few hours': Greek official

Political talks over Greece must produce a strong outcome on Sunday for the European Central Bank to provide continued support, while there's only "very low" leeway to reprofile Greece's debt, euro zone leaders said, according to Reuters.

Athens on Wednesday formally applied for a three-year loan. Euro zone finance ministers will meet this weekend to discuss the reforms.

"I think we've got two things that have been weighing on the market in the last several sessions that have turned around," David Schiegoleit, managing director of investments for The Private Client Reserve of U.S. Bank, said earlier. "Not only did we have a nice rally in China overnight (but we have) moderately positive comments from European leaders (on Greece)."

Germany's Finance Minister Wolfgang Schaeuble conceded on Thursday that Greece would need some debt restructuring as part of any new loan program to make its economy viable, Reuters reported. The cash-strapped government is expected to submit proposals by midnight Thursday.

U.S. stocks closed lower by nearly 1.5 percent or more on Wednesday, with the S&P and Dow below their 200-day moving averages, as continued concerns about Greece and the extended selloff in the Chinese market weighed on investor sentiment.

Floor trading on the New York Stock Exchange was suspended for more than 3.5-hours due to a technical glitch.

Tweet

"Some worries around the NYSE shut-down. Obviously that passed as well," said Bill Stone, chief investment strategist at PNC Asset Management. I'm "not sure that the Chinese worry has passed as well."

Read More NYSE: This is why we halted floor trading

"Whether it's Greece, China, or Puerto Rico, I think a lot of (Thursday's opening rally) has to do with the fact that we've been so long without a correction," said Jeff Clark, an analyst at Stansberry Research. "This is one of those situations where you see those wonder rallies for one or two days. ... I certainly wouldn't want to be buying on a big gap up today."

He said on Wednesday the S&P 500 came close enough to his 1-month forecast of 2,038 and is now oversold, setting up for a short-term bounce.

Investors also eyed Apple, which fell 2 percent to near its 200-day moving average.

"I think what you're seeing in Apple is the concerns in China," said Robert Pavlik, chief market strategist at Boston Private Wealth. "There's a lot of mixed signals out there. I think Apple is going to be fine in the long-run but near-term (face) some pressure."

In other international news, Secretary of State John Kerry said Thursday that major progress has been made in nuclear talks with Iran, but "some of the tough issues remain unresolved."

Crude oil futures for August delivery settled up $1.13, or 2.19 percent, at $52.78 a barrel on the New York Mercantile Exchange. Gold futures settled down $4.30 at $1,159.20 an ounce.

On the domestic front, gained slightly to 297,000, the highest level since February.

There are several Federal Reserve speakers on the calendar ahead of Fed Chair Janet Yellen's speech Friday.

Fed Governor Lael in a Reuters report the eight most important U.S. financial institutions may still cast too large of a shadow over the banking system. She added that sudden spikes in market volatility and developments in China are also areas of focus.

Separately, Kansas City Fed Bank President Esther George said in a Reuters report the Federal Reserve may stumble into a "trap" if it continues waiting for more data to justify an initial interest rate increase, risking a quick takeoff of inflation or other problems.

Earnings are also in focus, with PepsiCo and Walgreens Boots Alliance posting results before the bell.

Pepsico fell 1 percent despite reporting earnings that beat on both the top and bottom lines. The firm's profit margins expanded during the quarter, and it raised its full-year forecast, although it added that currency will have a negative impact of 11 percentage points on full-year profit.

Walgreens Boots Alliance surged more than 4 percent after the drug store operator posted earnings that best estimates one revenue that missed slightly. The firm also raised its full-year earnings forecast, and increased its quarterly dividend by 6.7 percent to 36 cents per share.

Read MoreEarly movers: PEP, AA, WBA, AVP, LB, AZN, MA & more

"We're off to a decent start (in earnings) but it's a little down from the first quarter," said Nick Raich, CEO of The Earnings Scout. "But the focus overseas is still driving markets. Policy makers are doing everything they can to prevent selloff in China."

Bond yields rose, with the 10-year yield at 2.30 percent and the 30-year yield at 3.10 percent. The U.S. Treasury auctioned $13 billion 30-year bond auction at a high yield of 3.084 percent.

The U.S. dollar traded higher, with the euro briefly dipping below $1.10.

The Dow Jones Industrial Average closed up 33.2 points, or 0.19 percent, at 17,548.62, with Travelers leading gains and Apple the greatest decliner.

The closed up 4.63 points, or 0.23 percent, at 2,051.31, with financials leading seven sectors higher and utilities the greatest laggard.

The Nasdaq closed up 12.64 points, or 0.26 percent, at 4,922.40.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, rose to trade near 19.

About three stocks advanced for every two decliners in the New York Stock Exchange, with an exchange volume of 827 million and a composite volume of 3.4 billion in the close.

—CNBC's Peter Schacknow contributed to this report.

On tap this week:

Thursday

Earnings: PriceSmart, Cintas, Barracuda Networks

Friday

10 a.m.: Wholesale trade

11:35 a.m.: Boston Fed President Eric Rosengren

12:30 p.m.: Fed Chair Janet Yellen on economy

More From CNBC.com:

Berkshire Hathaway Live Event