The S&P 500 closed about 1 point higher at 1,881, with utilities leading advancers and energy falling more than 2 percent as the greatest decliner. In afternoon trade, the index briefly fell below 1,867, its low from August that many traders are watching as a support level. The index breached the level in intraday trade Friday but ended above, at 1,880.
Also weighing on stocks in afternoon trade was a Reuters headline that the "Saudi foreign minister refuses to rule out seeking a nuclear bomb if Iran manages to obtain one." However, in the actual quote the minister said it would not be logical to discuss the issue in public and that it wouldn't be reasonable to answer the question one way or another.
"(The headline) exacerbated the last leg down but I don't think beyond today or this afternoon it means much," said Jeremy Klein, chief market strategist at FBN Securities.
For Klein and several other analysts, the next level after the August low is the October 2014 low of 1,820.
The Dow Jones industrial average closed about 28 points higher, holding little of its opening gains of more than 180 points but more than recovering from a roughly 88-point dip in afternoon trade. UnitedHealth and McDonald's contributed the most to gains, while Exxon Mobil and Chevron were the greatest weights on the index.
The Dow transports gave up opening gains to close about half a percent lower.
Stocks opened higher as oil gained and softer Chinese data spurred some hopes of further monetary stimulus. Asian markets closed higher, with the Shanghai composite up more than 3 percent. European stocks held more than 1 percent higher.
Overnight, China reported GDP of 6.9 percent for 2015, the slowest pace since 1990. Fourth-quarter GDP growth was 6.8 percent year-over-year, a touch below expectations. December retail sales showed 11.1 percent growth from the same period last year, while industrial production grew 5.9 percent. Both were mildly below estimates.
Read MoreGartman: Why any stock bounce will be short-lived
"I think the Chinese numbers weren't that great. They weren't that bad. They were kind of in-line with expectations," said James Meyer, chief investment officer at Tower Bridge Advisors. "I think the fear on Friday was overdone a bit and we're seeing a little relief rally"
"I wouldn't read anything more into this than a relief rally," he said. "We're not out of the woods yet. We have entered a period of very slow worldwide growth."
On Tuesday, the International Monetary Fund cut its global economic growth forecast for 2016 to 3.4 percent, down from prior forecasts but up from a 3.1 percent forecast for 2015.
Read More IMF: We were right on China—here's what's next
Analysts also noted support for initial gains in stocks from encouraging Bank of America, Morgan Stanley and UnitedHealth earnings.
"I do think some of the bank earnings have come in a little better than feared and that certainly has helped," said Nick Raich, CEO of The Earnings Scout.
IBM, and Netflix are among the firms due to report after market close.
Read MoreThese are risks for markets in week ahead
In economic news, the NAHB housing index held steady at 60 in January, but from a downwardly revised December reading and off a recent high of 65 in October.
Treasury yields edged higher, with the 2-year yield at 0.88 percent and the 10-year yield at 2.05 percent.
"The movement that we've seen (in the Treasury market) revolves around the path the Fed is going to take," said Bryce Doty, senior fixed income manager with Sit Investment Associates. He added that any stability in equities encouraged a view of a faster pace of Fed tightening.
The U.S. dollar traded mildly higher against major world currencies, with the euro above $1.09 and the yen at 117.59 yen against the greenback.
Oil hit fresh 12-year lows amid continued concerns about oversupply. The International Energy Agency said Tuesday that supply continues to exceed demand, placing "enormous strain" on the ability of the oil system to absorb it efficiently and putting further pressure on oil prices.
U.S. stock markets were closed Monday for the Martin Luther King, Jr. holiday. Stocks closed more than 2 percent lower Friday for the S&P 500's and Dow Jones industrial average's worst 10-day start to a year on record.
As of Tuesday's close, the S&P 500 was down nearly 8 percent for the year so far.
The Dow Jones industrial average closed up 27.94 points, or 0.17 percent, at 16,016.02, with UnitedHealth leading advancers and Chevron the greatest laggard.
The S&P 500 closed up 1.00 point, or 0.05 percent, at 1,881.33, with utilities leading five sectors higher and energy the greatest decliner.
The Nasdaq composite closed down 11.47 points, or 0.26 percent, at 4,476.95. Apple and Microsoft closed about half a percent lower or more, while the iShares Nasdaq Biotechnology ETF (IBB) ended 2.2 percent lower.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held near 26.
About two stocks declined for every advancer on the New York Stock Exchange, with an exchange volume of 1.2 billion and a composite volume of nearly 4.9 billion.
Gold futures for February delivery settled down $1.60 at $1,089.10 an ounce.
Read MoreEarly movers: BAC, MS, MCD, UNH, NFLX, YHOO, KORS & more
—Reuters contributed to this report.
On tap this week:
Earnings: Goldman Sachs, F5 Networks, ASML Holdings, Northern Trust, TD Ameritrade, SLM, Texas Capital Bancshares, Raymond James, Commerce Bancshares, Xilinx
7 a.m.: Mortgage applications
8:30 a.m.: CPI
8:30 a.m.: Housing starts
Earnings: American Express, Travelers, Fifth Third, ETrade, Starbucks, Intuitive Surgical, Union Pacific, Verizon, Bank of NY Mellon, Alaska Air, Southwest Air, JB Hunt, KeyCorp, Canadian Pacific Railway, Schlumberger, People's United Financial
8:30 a.m.: Jobless claims
8:30 a.m.: Philadelphia Fed business outlook survey
10:30 a.m.: Natural gas inventories
11:00 a.m.: Oil inventories
4:30 p.m.: Fed balance sheet, monetary supply
Earnings: General Electric, Kansas City Southern, SunTrust, Legg Mason, Synchrony Financial, SAP
8:30 a.m.: Chicago Fed national activity index
9:45 a.m.: Manufacturing PMI
10 a.m.: Existing home sales
10 a.m.: Leading indicators
1 p.m.: Oil rig count
*Planner subject to change.
More From CNBC.com: