U.S. stocks closed higher by about 1.5 percent or more Wednesday, following a rally in global markets, but the major averages still posted the worst quarter in four years. (Tweet This)
"I think there's a lot of short covering going on. A lot of people looking at yesterday's dip as a successful retest of the lows," said Marc Chaikin, CEO of Chaikin Analytics. "We have to see how the market closes out this week and the first trading week of October."
The major averages closed about 7 percent lower for the third quarter, their worst since 2011.
Read MoreThis chart could signal a bottom for stocks
Stocks closed near session highs Wednesday, recovering into the close after briefly halving morning gains.
The Dow Jones industrial average closed up 235.57 points after leaping as much as 248.47 points. Nike led gains, while Procter & Gamble was the greatest weight on the blue chip index.
The S&P 500 rallied 1.9 percent to close at 1,920, after opening below the psychologically key 1,900 level.
Ilya Feygin, senior strategist at WallachBeth Capital, said the S&P came off its highs after hitting resistance 1,912-1,915. "We're trading just kind of technically in between there (and 1,877)."
"I think the data coming up is going to be very important. That's why (there's) volatility," he said. China releases PMI data late Wednesday ET and the key September U.S. nonfarm payrolls report is due Friday morning.
The Nasdaq composite closed up more than 2 percent, helped by gains of nearly 4.8 percent in the iShares Nasdaq Biotechnology ETF (IBB). IBB remained in a bear market, or more than 20 percent below its 52-week high, after a sharp sell-off in recent weeks. The ETF lost about 17.8 percent for the quarter, its first negative quarter in 11.
Chaikin noted that Apple underperformed the major indices with a gain of about 0.8 percent on the day. "The fact that Apple can't get going is negative for the market," he said. The iPhone maker stock posted a nearly 12.1 percent loss for the quarter.
Read MoreIMF's Lagarde: Global growth likely weak this year, modest acceleration in 2016
"Nothing has changed fundamentally from yesterday to today except that most of the globe is rallying with weaker-than-expected data points, with the hope of more stimulus from central banks," said Ryan Larson, head of U.S. equity trading at RBC Global Asset Management.
"The key thing is, does the early strength ultimately equate to the strength at the end of the day?" he said. "As those shorts are covered that buying interest isn't there."
In pre-market trade, Dow futures were more than 160 points higher, while European markets traded more than 2 percent higher. Asian stocks posted gains, with Japan's Nikkei 225 stock index rallying 2.70 percent.
Soft data in Japan and the euro zone boosted hopes of more stimulus in those regions. Japanese industrial production unexpectedly fell 0.5 percent in August for the second-straight month of declines, government data showed Wednesday.
For the first time in six months, euro zone prices fell in September from the same period last year, according to the European Union's statistics office Eurostat.
Analysts also noted support for Tuesday's gains from continued signs of improvement in the U.S. labor market.
Ahead of Friday's key nonfarm payrolls data, the September ADP Employment report showed private companies added 200,000 jobs.
"I think that's certainly lending some credibility to the gains that are there," said Paul Springmeyer, senior portfolio manager at the Private Client Reserve at U.S. Bank.
"Investors are being more cautious and tactful, hence the heightened levels of volatility. We've been at pretty subdued levels (of volatility). I think any time you see multiple point percentage swings it's an overreaction," he said.
U.S. stocks closed mixed Tuesday, after plunging nearly 2 percent or more on Monday.
Read More Carl Icahn: I think markets are overpriced, earnings are misstated
Crude oil settled down 14 cents, or 0.31 percent, at $45.09 a barrel. Oil struggled to rally amid concerns about a hurricane on the U.S. East Coast, news of escalation in the Syrian war, and a report that crude stockpiles rose far more than expected.
Copper spiked amid . Commodities trading and mining giant Glencore continued to recover with a gain of more than 11 percent.
"It warns of these companies in terms of their debt and how they've managed their balance sheets," said Mark Luschini, chief investment strategist at Janney Montgomery Scott. "That to me is more a symptom of what's happened in the commodity complex than a signal."
Read MoreInvestors cut junk bond holdings as debt fears mount
Wednesday was the last day of September and the final day of the third quarter, the worst since 2011 according to Barclays.
"The third quarter to me reflected uncertainty about the Federal Reserve, the uncertainty caused by not knowing how the central bank is going to raise rates. If you get a good labor report that may steel the nerves of the Fed," said David Kelly, chief global strategist at JPMorgan Funds.
Concerns about spillover from slowdown in China and the timing of a Federal Reserve rate hike sent markets into correction territory, or more than 10 percent below their 52-week highs, in late August.
The major U.S. averages recently fell back into correction mode and were close to retesting the August lows Tuesday. The Russell 2000 held below its Aug. 24 low Tuesday and posted a 12.2 decline for the quarter, its first negative quarter in four.
"You have increasing chatter about the rally into the year-end and that raises the question, what's going to be the catalyst for that?" Luschini said, noting increasing focus on third-quarter earnings reports following Friday's employment report.
"We think this is still in the context of this being a correction rather than a bear market," he said.
Read MoreRocky stock market faces potential pitfalls into year-end
"Hopefully we should be looking forward. We just came through a rough, 6-week patch. A lot of it was due not to fundamentals but emotions," Larson said. "We should be looking forward if ADP is any indication on a fairly consistent picture of the labor market."
In other economic news, weekly mortgage applications fell 6.7 percent on a seasonally adjusted basis for the week ending September 25, according to the Mortgage Bankers Association (MBA).
The September Chicago purchasing managers index came in at 48.7, below expectations of 53.0.
Treasury yields fell, with the lower at 0.64 percent and the 10-year yield at 2.06 percent.
The U.S. dollar traded higher against major world currencies, with the euro below $1.12 and the yen at 119.83 yen against the greenback.
Read MoreEarly movers: RL, CHK, PLAY, CUDA, COST, LMT, JPM & more
U.S. Federal Reserve Chair Janet Yellen is expected to give the opening remarks at a Community Banking Research and Policy Conference at 3 p.m. ET in St. Louis, Missouri. Last week the Fed chief suggested that the central bank was still likely to lift interest rates before year-end.
The Fed chair did not comment on the U.S. economy or monetary policy in the prepared remarks, Reuters reported.
St Louis Fed President James Bullard, New York Fed President Bill Dudley and Federal Reserve Governor Lael Brainard are also scheduled to speak later in the day.
Major U.S. Indexes
Developments in Washington could fall under the spotlight since the Federal Government runs out of money at midnight — unless Congress and the President approve a new budget or a continuing resolution.
The Senate approved legislation Wednesday to avoid a shutdown, while the House of Representatives is expected to vote on the bill later in the afternoon.
Failure to reach an agreement will result in a government shutdown Thursday.
The Dow Jones Industrial Average closed up 235.57 points, or 1.47 percent, at 16,284.70, with Chevron leading advancers and Procter & Gamble and Verizon the only decliners.
The blue chip index ended the quarter down 7.58 percent, for its first three consecutive quarterly decline since 2009, with Nike up 13.8 percent as the greatest quarterly gainer, while Caterpillar plunged nearly 23 percent as the greatest laggard.
The Dow transports closed up 1.1 percent on the day but fell about 3.8 percent for the quarter, posting three consecutive negative quarters for the first time since 2009.
The closed up 35.94 points, or 1.91 percent, at 1,920.03, with consumer discretionary leading all 10 sectors higher.
The index posted a 6.94 percent loss for the quarter, posting two consecutive quarterly loss for the first time since 2011. Utilities was the only gainer, while energy plunged 18.1 percent as the greatest decliner on the quarter.
The Nasdaq closed up 102.84 points, or 2.28 percent, at 4,620.16. The index ended the quarter down 7.35 percent, halting 10 consecutive quarters of gains.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held near 24.
About three stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 1.2 billion and a composite volume of nearly 4.5 billion in the close.
Gold futures for December delivery settled down $11.60 to $1,115.20 an ounce.
On tap this week:
Wednesday
3 p.m.: Fed Chair Janet Yellen welcoming remarks at St. Louis Fed event
3:10 p.m.: St. Louis Fed President James Bullard at St. Louis Fed community banking event
8:15 p.m.: Fed Gov. Lael Brainard at St. Louis Fed event
Thursday
September vehicle sales
8:30 a.m.: Initial claims
9:45 a.m.: Manufacturing PMI
10 a.m.: ISM manufacturing; construction spending
2:30 p.m.: St. Francisco Fed's Williams on outlook
Friday
8:30 a.m.: Employment; Boston Fed President Eric Rosengren at Boston Fed conference
9 a.m.: Minneapolis Fed President Narayan Kocherlakota
10 a.m.: Factory orders
11 a.m.: Cleveland Fed President Loretta Mester
1:30 p.m.: Fed Vice Chair Stanley Fischer on monetary policy at Boston Fed
More From CNBC.com: