U.S. stocks closed lower Thursday, stabilizing after their largest three-day gain since August, as investors eyed oil prices and corporate news. (Tweet This)
"I think we're in a trading-range market. I think there's a need for time to indicate oil is stabilizing at current levels," said Terry Sandven, chief equity strategist at U.S. Bank Wealth Management.
U.S. crude oil futures came off session highs but managed to eke out gains, up 11 cents at $30.77 a barrel, after weekly crude inventories rose by 2.1 million barrels.
WTI's slight gain broke a 23-session streak of moves of at least 1 percent (back to Jan. 13).
The S&P 500 and Nasdaq composite quickly gave up opening gains to close down about half a percent and 1 percent, respectively. The Dow Jones industrial average ended about 40 points lower after struggling for gains earlier in the session as a rise in shares of IBM countered declines in Goldman Sachs and Wal-Mart.
IBM, which contributed 42 points to gains in the Dow, closed up 5 percent for its biggest daily gain since July 2011. The stock is down more than 3.5 percent year-to-date.
Morgan Stanley upgraded IBM to "overweight" from "equal-weight" and raised its price target to $140 from $135 on underappreciation of the firm's increased focus on analytics and cloud businesses.
Separately, IBM Watson Health announced plans to acquire Truven Health Analytics for $2.6 billion.
The Nasdaq composite underperformed the major averages, ending down 1 percent as major tech names declined and the iShares Nasdaq Biotechnology ETF (IBB) closed down 2.59 percent. Apple lost 1.9 percent and Netflix fell 4.5 percent.
"I think we've had a really, really powerful three-day run up," said Peter Coleman, head trader at Convergex.
"We're due for some profit-taking and I think that's what you're getting today," he said.
Energy ended nearly 1 percent lower as the greatest decliner in the S&P 500. Wal-Mart was the second-greatest weight on the Dow. The stock closed well above session lows, but still 3 percent lower after its quarterly report showed pressure from the strong U.S. dollar.
As of Thursday's close, the major U.S. averages were up more than 2.5 percent for the week so far, on pace for their best week since November.
"We had a nice move here. The market is now overbought for the first time in a while," said Peter Boockvar, chief market analyst at The Lindsey Group.
European stocks came off highs to close mixed, while in Asia the Nikkei 225 and Hang Seng surged more than 2 percent. The Shanghai composite was a touch lower but held gains of 3.6 percent for the week so far.
"Oil, China and central banks are our key uncertainties and a lot of that has been mitigated in recent days but we still need corporate earnings (growth)," said Douglas Cote, chief market strategist at Voya Investment Management.
Wal-Mart beat estimates by 3 cents with adjusted quarterly profit of $1.49 per share, but revenue was shy of estimates and the retail giant trimmed its full-year revenue forecast given the strong U.S. dollar. The company raised its annual dividend to $2 a share from $1.96 a share.
Read MoreWal-Mart results spook investors
In economic news Thursday, weekly jobless claims came in at 262,000.
The Philly Fed index came in at minus 2.8 for February. The index has held in negative territory since September.
Leading indicators in January showed a decline of 0.2 percent, after a downwardly revised December report of a 0.3 percent drop, according to StreetAccount.
Treasury yields fell, with the at 0.70 percent and the 10-year yield at 1.74 percent.
The U.S. dollar index held mildly higher, with the euro at $1.109 and the yen at 113.25 yen against the greenback.
Earlier, U.S. crude oil futures held more than 3 percent higher above $31.50 a barrel after Iran welcomed plans by Russia and Saudi Arabia to freeze output and an industry report showed a surprise drop in U.S. inventories. Natural gas inventories fell 158 billion cubic feet last week.
"There wasn't really much correlation (with stocks) because for much of the day the oil prices were up," said Peter Cardillo, chief market economist at First Standard Financial.
Late Wednesday, St. Louis Fed President James Bullard said it would be "unwise" for the Fed to continue raising rates given declining inflation expectations and recent equity market volatility. The comments mark a shift from Bullard's arguments over much of last year for an earlier rate hike.
U.S. stocks closed more than 1.5 percent higher Wednesday, after the release of the Fed minutes, and helped by higher oil prices and some encouraging economic data. The Dow Jones industrial average and S&P 500 posted their first three-day win streak of 2016.
The major U.S. averages had their largest three-day win streak since late August.
"The question is, can we get enough lift to push above 1,940 (on the S&P 500) and if we can, we can have a shot at that 1,970 - 2,000 level. You're going to really need buyers to come into the market. ... Short covering can only take us so far," said Lance Roberts, chief investment strategist at Clarity Financial.
On Wednesday, the S&P also had its third-straight day of plus-1 percent gains since 2011 to end within 10 percent of its 52-week intraday high, out of correction territory. The index ended more than 10 percent below that high Thursday, but held above the psychologically key 1,900 level for a second-straight day.
The Dow Jones industrial average closed down 40.40 points, or 0.25 percent, at 16,413.43, with Wal-Mart the greatest laggard and IBM leading advancers.
The closed down 8.99 points, or 0.47 percent, at 1,917.83, with energy leading eight sectors lower and utilities and telecommunications the only gainers.
The Nasdaq composite closed down 46.53 points, or 1.03 percent, at 4,487.54.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held near 21.6.
Advancers were a touch ahead of decliners on the New York Stock Exchange, with an exchange volume of nearly 1.1 billion and a composite volume of 4.4 billion in the close.
Gold futures for April delivery settled up $14.90 at $1,226.30 an ounce.
—Reuters and CNBC's Peter Schacknow and Chris Hayes contributed to this report.
On tap this week:
Earnings: Deere, Public Service, VF Corp, Cabot Oil and Gas, Allianz, Pinnacle West, Echostar
8:30 a.m. CPI
8:40 a.m. Cleveland Fed President Loretta Mester
1 p.m.: Oil rig count
*Planner subject to change.
More From CNBC.com: