U.S. stocks closed higher Thursday, off session highs as a bounce in oil and major stocks failed to completely offset increased uncertainty heading into the Federal Reserve's key meeting next week.
"I think a lot of this is volatility awaiting the Fed meeting," said Marc Chaikin, CEO of Chaikin Analytics. "There's some good leadership in the market along with Apple and that's always comforting to traders."
The Dow Jones industrial average closed about 80 points higher after gaining as much as 188 points with Apple and UnitedHealth the greatest drivers. The Nasdaq outperformed, briefly gaining more than 1.2 percent, boosted by biotechs and Apple.
"There's still continued lack of conviction and any real liquidity," said Myles Clouston, senior director at Nasdaq. "Investors have been spooked by what's happened in the last month, month-and-a-half."
Apple closed up 2.4 percent, recovering losses of 1.92 percent from Wednesday when it unveiled new iPhones, the iPad Pro and other products. The iShares Nasdaq biotechnology ETF (IBB) briefly jumped more than 2 percent.
"You have a rally in metals, a rally in oil, and here we (were) at the highs of the day," Peter Cardillo, chief market economist at Rockwell Global Capital, said of the intraday rally.
Crude oil settled up $1.77, or 4.01 percent, at $45.92 a barrel, more than reversing Wednesday's 3.9 percent decline. Crude held higher in intraday trade despite weekly inventory numbers that showed a greater-than-expected build of 2.6 million barrels.
Natural gas inventories rose 68 billion cubic feet. Metals, including copper and gold, also gained about half a percent.
"You're basically catalyst-free for the day," said Art Hogan, chief market strategist at Wunderlich Securities. "A little bounce in Apple and WTI — both of those are very constructive."
Still, he emphasized it was a wait-and-see market. "A lot of investors are sitting on the sidelines, waiting for the Fed meeting next week."
Analysts said uncertainty over the timing of a rate hike kept stocks in a trading range.
The Federal Open Market Committee could raise short-term interest rates for the first time in more than nine years at its meeting next Wednesday and Thursday.
"Right now people are betting the Fed will not do anything. I think if the Fed were to increase, (we'd see a) two to three day drop that would scare a lot of people and the market (would) test Aug. 26 lows," Chaikin said.
Read MoreThis is what could tip Fed's hand
Earlier, the major averages shook off a mildly lower open to fluctuate between slight gains and losses. Futures reversed gains in premarket trade to turn lower, with the Dow futures briefly falling more than 100 points.
"He did not give a bullish tone to the market," said John Caruso, senior market strategist at RJO Futures.
The Dow Jones industrial average remained in correction territory, more than 10 percent below the 52-week high hit May 19.
The other major averages held out of correction mode. In morning trade, the S&P 500 was about 4.2 percent above the closing low of the correction hit on Aug. 25. The Dow was also 4 percent above that level, while the Nasdaq was 5.8 percent above that level.
Of the S&P sectors, only utilities was trading below its Aug. 25 close.
Source: TD Ameritrade
"The market's got to do more work down at these levels. You've done a lot of technical damage to the market. ... I also think there's a little bit of confidence rebuilding that needs to occur because of what happened two weeks ago, which was a mini-flash crash," said Dan Veru, chief investment officer at Palisade Capital Management.
In economic news, initial jobless claims fell 6,000 to a seasonally adjusted 275,000 for the week ended Sept. 5, the Labor Department said on Thursday. It was the 27th straight week that claims remained below the 300,000 threshold, which is usually associated with a strengthening labor market.
U.S. import and export prices posted their largest drop in seven months.
Longer-term Treasury yields gained while the shorter-end held lower, with the at 0.73 percent and the 10-year yield at 2.23 percent.
The Treasury Department auctioned $13 billion of 30-year bonds at a high yield of 2.980 percent.
The U.S. dollar traded about half a percent lower against major world currencies, with the euro topping $1.12 and the yen near 120.6 yen against the greenback.
"The markets are starting to coil. The range of the (FX) market trends tend to get tighter as traders and investors (grow) uncertain ahead of next week's Fed meeting Wednesday," RJO's Caruso said.
declined 0.1 percent in July, missing expectations for a slight gain. Sales decreased 0.3 percent.
In corporate news, Lululemon Athletica plunged 16.4 percent after reporting that margins narrowed. Quarterly earnings did beat on both the top and bottom line, while same-store sales exceeded forecasts with a gain of 6 percent.
In Europe, the pan-European STOXX 600 index closed more than 1 percent lower, pressured by weak data from Japan and China. Core machinery orders in Japan fell by 3.6 percent in July, while in China, the producer price index fell by 5.9 percent.
The Shanghai Composite closed 1.45 percent lower, while the Hang Seng and Nikkei ended down more than 2.5 percent.
Shares of Avon spiked before closing 2.65 percent lower after a Dow Jones report the firm is in discussion with private equity firms about investment support for the struggling company.
The closed up 10.24 points, or 0.53 percent, at 1,952.28, with information technology leading nine sectors higher and utilities the only decliner.
The Nasdaq closed up 39.72 points, or 0.84 percent, at 4,796.25.
The CBOE Volatility Index (.VIX), widely considered the best gauge of fear in the market, traded near 25.
About eight stocks declined for every seven advancers on the New York Stock Exchange, with an exchange volume of 943 million and a composite volume of nearly 3.6 billion in the close.
Gold futures settled up $7.30 at $1,109.30 an ounce.
—Reuters and CNBC's Patti Domm, Gina Francolla and Peter Schacknow contributed to this report.
On tap this week:
Earnings: Finisar, Zumiez
4:30 p.m.: Fed balance sheet, money supply
Earnings: Kroger, Mattress Firm
8:30 a.m.: PPI
10 a.m.: Consumer sentiment
1 p.m.: Oil rig count
2 p.m.: Treasury budget
More From CNBC.com: