U.S. stocks shot higher on Wednesday, rebounding from six consecutive days of declines that pushed the major averages into correction territory. (Tweet This) In addition to an oversold bounce, some analysts also attributed the gains to comments from the Fed's William Dudley that a September rate hike looks "less compelling" and a strong durable-goods report. The major averages closed about 4 percent higher for their best day since 2011, with the S&P 500 rising out of correction territory. The index fell into correction during Monday's selloff. [Programming note: CNBC will air a special report on the market recovery at 7 p.m., ET]

Among the 10 S&P 500 sectors, tech, financials, health care, consumer discretionary and staples are all out of correction territory. The companies in the index gained about $640 billion in market capitalization on Wednesday, but have still lost $268 billion in capitalization this week and are down $1.3 trillion over the last week-and-a-half. The Nasdaq Composite closed on the edge of correction, up 4.2 percent on the day. The Dow Jones industrial average remains in correction territory.

Gains accelerated into the close, with the Dow Jones industrial average ending up about 620 points after rising as much as 637 points. Read MoreBy the numbers: Markets roar back from declines On Tuesday, stocks failed to close higher. The Dow and S&P 500 followed Monday's sharp selloff with an initial bounce of nearly 3 percent or more before ending more than 1 percent lower for their biggest reversal since October 2008. "It's a nice reflex rally today but it still hasn't come close to retracing... the decline," said Marc Chaikin, CEO of Chaikin Analytics. "This is a bounce, just short covering. Very typical."

Stocks traded in a range throughout the day, paring gains after European stocks closed lower and spiking Dudley's comments. Read MoreSeven reasons why the market has gone totally nuts

The Russell 2000 closed more than 2 percent higher. Earlier, the index briefly fell into negative territory as GrubHub briefly plunged nearly 10 percent on a downgrade by Barclays. The stock closed down about 6 percent. "From what I've seen so far this morning in trades it looks more like bouncing," said Tim Dreiling, senior portfolio manager with the Private Client Reserve at U.S. Bank. "It's more risk-on." He said it's "a coin toss on (whether) will we see the last hour of trading deteriorate."

Major averages' 5-day performance



in July rose 2.2 percent, above the expected 0.1 percent rise, but down from the 3.4 percent gain last month. "U.S. markets have had real good economic data. Strong durable-goods orders came in a big surprise," said Doug Cote, chief market strategist at Voya Investment Management. He also noted a strong revision to the June figures and Tuesday's good consumer confidence numbers and home price increases. Stocks pared gains after a sharp rally in the open of more than 2.5 percent. Read MoreSizing up 'safe havens': gold vs dollar vs euro

"It looks just like yesterday at this time where things are weaker (in) general overseas, but people look optimistic at the open," said Randy Frederick, managing director of trading and derivatives at Charles Schwab. "Overseas, the Chinese markets are still down. I don't think that's a huge deal but people seem to think it does," he said. The Shanghai composite closed down 1.3 percent after fluctuating throughout the day. The Hang Seng also closed lower, while Japan's Nikkei jumped 3.2 percent. European stocks closed lower but off sharp initial lows. "Today is the first day in which global equity markets are mixed, not collectively up big or down big," Katie Stockton, chief technical strategist at BTIG, said in a morning note. "This could be an early indication of the correction releasing its hold, but we have yet to see a reaction to widespread oversold conditions," she said. "The extremes in our market internal measures support a relief rally in the days ahead, and we think the magnitude of that rally may hold information about whether the breakdowns that have occurred are real or shakeouts." Before Wednesday's trading, the Dow futures implied 450-plus point open.

The New York Stock Exchange invoked Rule 48 for a third straight session. Before this week, Rule 48 was most recently invoked in January 2015. In all, Rule 48 has been used 67 times since it was approved in 2007, according to an NYSE spokeswoman. The goal of the rule is to ease market volatility. Overnight, China's central bank said it had injected 140 billion yuan ($21.8 billion) into the interbank money market via short-term liquidity operations (SLOs).

The People's Bank of China fired a double-barreled easing shot on Tuesday—lowering interest rates and the reserve requirement ratio (RRR) by 25 basis points and 50 basis points respectively—but this was not enough to reassure markets of slowing growth fears. "Investors are still pretty cautious about this rally," said Mark Luschini, chief investment strategist at Janney Montgomery Scott. He viewed the Dow futures' leap as "acting suspiciously." "This is an opportunity to lighten up on positions you didn't get to yesterday," he said.

The U.S. dollar held mildly higher against major world currencies, with the euro below $1.14 and the yen slightly weaker near 119.7 yen against the greenback.

Treasury yields spiked after the durable goods report and held just below highs, with the 10-year yield near 2.19 percent and the at 0.67 percent. "The Treasury market is sailing through some rough seas here. The risk-off rally we experienced on Monday drove us well through fair value and today we are dealing with the unwind," said Brandon Swensen, co-head of the fixed income desk at RBC Global Asset Management. The Treasury Department auctioned $35 billion of 5-year notes at a high yield of 1.463 percent, the lowest since April. Demand was slightly weaker.

Crude oil futures settled down 71 cents, or 1.81 percent, at $38.60 a barrel on the New York Mercantile Exchange. Gold futures ended down $13.70 at $1,124.60 an ounce.

In individual stock moves, shares of Syngenta dove 18 percent after Monsanto said its $47 billion bid to buy the Swiss rival fell through. Shares of the U.S.-listed seed company jumped 8 percent. Schlumberger fell about 5 percent after the firm announced a $14.8 billion acquisition of oil equipment manufacturer Cameron International. The company's shares leaped more than 40 percent.



Major U.S. Indexes