U.S. stocks closed about 1 percent higher on Tuesday as investors found encouragement from some recovery in oil prices and Chinese stocks, amid mixed earnings and the beginning of the Federal Reserve's two-day meeting. (Tweet This)
"Oil is definitely having a good impact. When you see the price of oil up, that's giving you indications that people are moving into areas that have been hard hit," said Robert Pavlik, chief market strategist at Boston Private Wealth.
However, he said the market could move lower again before ending the year higher. The trade volume is "not enough to convince me the tide has turned," Pavlik said.
The major averages broke a five-day losing streak. The Dow Jones industrial average closed about 190 points higher after briefly gaining more than 200 points, with Exxon Mobil, Chevron and Caterpillar among the greatest advancers.
The energy sector leaped about 3 percent as the greatest advancer in the S&P 500, which closed 1.2 percent higher. Oil recovered to trade near $48 a barrel.
It's a "commodity that has been unidirectionaly lower and you get a bounce," said Art Hogan, chief market strategist at Wunderlich Securities. He noted the recovery in energy stocks helped materials and industrials as the next-best performing sectors in the S&P 500.
59 cents, or 1.24 percent, at $47.98 a barrel, after trading lower for the last four sessions.
Phil Flynn, energy market analyst at The Price Futures Group, noted some short covering ahead of crude inventory data and the conclusion of the Fed meeting Wednesday, amid some stabilization in China.
"China didn't crash," he said. "If China becomes stable the market will focus on their demand-supply which is strong (for oil)."
The Federal Open Market Committee began its two-day meeting Tuesday. No press conference is scheduled at its conclusion Wednesday afternoon.
"The market focus is going to pivot away from Asia and away from commodities and towards the Fed," said David Schiegoleit, managing director of investments at U.S Bank Private Client Reserve.
"If the Fed signals to the dovish side that could point to a rally in the equity market," he said.
China remained in focus, with Shanghai's benchmark stock market closing down 1.7 percent in a recovery from an intraday decline of as much as 5 percent. China's securities regulator said on Tuesday that it had launched an investigation into Monday's selloff, when stocks fell more than 8 percent.
While the Nikkei joined the Shanghai Composite in negative territory, the Hang Seng closed up 0.62 percent.
"Part of what's pushing (the S&P 500) higher is overnight the Shanghai Composite ... ended up rallying on an intraday basis. I think there was some relief on that front," said Mark Luschini, chief investment strategist at Janney Montgomery Scott. "So there's a rally in global risk along with (support around) the 200-day moving average which is going to provide some reason for equities to bounce today."
European stocks closed higher, with the DAX up about 1 percent. Stock futures were also higher following the rally attempt in Asia.
"I think the market right now is very focused on earnings," said Peter Boockvar, chief market analyst at The Lindsey Group. "We're probably due for a bounce today based on the selling of the last couple days."
On Monday, stocks extended a recent decline with the S&P 500 closing just above its 200-day moving average and the Dow Jones industrial average at lowest level in nearly six months.
"To me it looks like an orderly pullback," said Katie Stockton, chief technical strategist at BTIG. "What's interesting is these pullbacks—even though they're extremely shallow—they generate a lot of skittish sentiment."
She said the 200-day moving average acts more as a "cushion" and that 2,044 on the S&P 500 is a more significant indicator of market deterioration.
In economic news, U.S. consumer confidence for July came in at 90.9, missing expectations and posting a decline from June's read of 99.8.
The Case-Shiller 20-city home price index rose 4.9 percent in May from the same period last month, matching April's pace. The gain missed expectations for a 5.6 percent increase.
The home ownership rate dropped to 63.4 percent, the lowest level since 1967.
The Markit flash services PMI rose slightly from a five-month low, hitting 55.2 in July. The average for the year so far is 56.3.
Treasury yields held slightly higher, with the U.S. 10-year yield at 2.25 percent and the at 0.66 percent.
The dollar held higher against major world currencies, with the euro lower at $1.10.
Ford closed up nearly 2 percent after the firm posted its best quarterly performance since 2000, with quarterly profit topping estimates and marking the automaker's highest every quarterly profit for North America.
UPS reported higher second-quarter net profit as improved margins offset a drop in revenue, Reuters reported. However, total revenue fell 1.2 percent from a year ago due to the strong U.S. dollar and lower fuel surcharges.
The stock closed up about 5 percent to boost the Dow transports 2.7 percent, its best day since the end of January.
Pfizer closed up nearly 1 percent after the firm raised its full-year forecast on rising sales of its newer drugs and beat expectations on both the top and bottom lines.
DuPont fell 1.46 percent to lead declines in the Dow after posting earnings that matched estimates on revenue that missed. The firm also lowered its outlook for the year on lower corn and soybean volumes as well as weaker demand for its crop protection products.
The China-based internet search giant Baidu topped earnings estimates but gave weaker-than-expected guidance for the current quarter. Shares closed down 15 percent.
The Dow Jones Industrial Average closed up 189.68 percent, at 1.09 percent, at 17,630.27, with Exxon Mobil jumping 4 percent to lead advancers and DuPont the greatest of two decliners. Cisco ended flat.
The closed up 25.62 points, or 1.24 percent, at 2,093.26, with energy leading all 10 sectors higher.
The Nasdaq closed up 49.43 points, or 0.98 percent, at 5,089.21.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded below 14.
About 11 stocks advanced for every four decliners on the New York Stock Exchange, with an exchange volume of 926 million and a composite volume of nearly 4.1 billion in the close.
Gold futures closed down 20 cents at $1,096.20 an ounce.
—CNBC's Peter Schacknow contributed to this report
On tap this week:
First day of two-day FOMC meeting
Earnings: BP, DuPont, Ford, Merck, UPS, Pfizer, UBS, JetBlue, Gilead Sciences, Twitter, Yelp, U.S. Steel, Panera Bread, SunPower, AK Steel, Corning, Cummins, Masco, Sturm Ruger, Buffalo Wild Wings, Equity Residential, Express Scripts, LVMH, DR Horton
Final day of FOMC meeting
Earnings: Facebook, Samsung, Whole Foods, Barclays, MasterCard, Anthem, General Dynamics, Northrop Grumman, Gannett, Garmin, Nissan, GlaxoSmithKline, Marriott, LaQuinta, Western Digital, Booz Allen Hamilton, Carlyle Group, SolarCity, Shutterfly, Thomson Reuters, WR Grace, Tableau Software, Sonus, Goodyear Tire, American Tower, Total
10:00 am: Pending home sales
2:00 pm: FOMC statement
Earnings: A-B InBev, Procter & Gamble, ConocoPhillips, Delphi Automotive, CME Group, Teva Pharmaceutical, Colgate-Palmolive, Sanofi, Amgen, LinkedIn, Boston Beer, FireEye, Western Union, Brunswick, Stanley Black and Decker, Marathon Petroleum, Starwood, Fiat Chrysler, Mondelez, Deutsche Bank, Diageo
8:30 am: Initial claims
8:30 am: Q2 GDP
Earnings: Exxon Mobil, Chevron, Honda Motors, Seagate Technology, TransCanada, Newell Rubbermaid, Weyerhaeuser, Phillip 66, CBOE Holdings, Legg Mason, ArcelorMittal
8:30 am: Employment cost index
9:45 am: PMI
10:00 am: Consumer sentiment
More From CNBC.com: