U.S. stocks closed mixed Tuesday, amid a rise in oil prices, as declines in tech and consumer discretionary stocks weighed after mixed earnings reports.
"I think on the whole earnings have come in supportive and that hasn't hurt," said Bill Stone, chief investment strategist at PNC Asset Management. On oil, "the correlation isn't as strong as it was earlier in the year but it certainly doesn't hurt when it's up."
The S&P 500 and Dow Jones industrial average closed at their highest levels of the year so far, and about 1.6 percent below their 52-week intraday highs. ( Tweet This ) The Dow transports closed up nearly 1.3 percent to within 10 percent of its 52-week intraday high, out of correction territory.
The S&P closed above the psychologically key 2,100 level for the first time since Dec. 1, 2015, while the Dow remained above the 18,000 level topped Monday.
"I think it's really positive that energy and financials are still strong, and materials," said Marc Chaikin, CEO of Chaikin Analytics. There's "some rotational profit-taking going on in the technology and consumer discretionary names."
"Netflix and Tesla are not really the stock market. They are the momentum of the day," he said.
The Nasdaq composite underperformed, closing 0.4 percent lower as Netflix (NFLX) plunged nearly 13 percent after giving lower-than-expected subscriber growth for the second quarter. Shares of Illumina (ILMN) plunged 23 percent after reporting revenue well below expectations and forecasting the slowest revenue growth in four years.
Shares of Alphabet, Amazon.com and Apple also declined to weigh on the Nasdaq. Tesla fell 2.5 percent.
Read More Tesla drops on Consumer Reports warning
IBM (IBM) closed down 5.59 percent, accounting for about 57 points off the Dow. IBM's earnings beat on both the top and bottom line, but revenue continued to fall and the firm did not raise its full-year guidance. The stock is still up more than 4.5 percent year-to-date.
Declines in information technology briefly dragged the S&P into negative territory. The index closed higher as materials surged 2 percent, followed by gains of more than 1 percent each in energy and financials. Energy and materials are the worst S&P performers over the last 12 months, while financials moved from third-worst to fourth-worst in the close.
"Certainly if the financials, because of the size, can get momentum, that can help drive the market to new highs," Stone said.
Goldman Sachs (GS) closed up 2.28 percent to contribute the most to gains in the Dow. The firm reported first-quarter earnings that topped lowered Wall Street expectations, but marked a fourth-straight quarter of profit declines as market volatility hit the company's bond trading and investment banking businesses. Revenue plunged about 40 percent from the year-ago period and missed estimates. The stock is down more than 9 percent for the year so far.
U.S. crude oil futures for May delivery settled up $1.30, or 3.27 percent, at $41.08 a barrel, breaking a four-day losing streak. After the settle Wednesday, the contract rolls to June, which settled up 3.11 percent at $42.47 a barrel.
On Monday, the Dow Jones industrial average closed above the psychologically key 18,000 level for the first time since July 20, 2015. All three major averages ended at their highest level of the year so far, with energy stocks leading as oil prices recovered from sharp losses.
"The market's very expensive and now it's going to be tested on a micro level when we see corporate earnings," said Peter Boockvar, chief market analyst at The Lindsey Group.
European stocks closed more than 1 percent higher, with the German DAX outperforming with gains of more than 2 percent. Germany's ZEW institute's latest Indicator of Economic Sentiment rose for the second month in a row in April to 11.2 points.
In Asia, the Nikkei 225 rebounded with gains of more than 3.5 percent, while the Hang Seng rose 1.3 percent and the Shanghai composite closed about 0.3 percent higher.
Read More Stocks to face another earnings test
"The SPX exceeded resistance near 2090 yesterday, defined by the downtrend channel connecting the July 2015 and November 2015 highs. Consecutive weekly (Friday) closes above this level would signify a breakout and bullish reversal, supporting upside follow-through in the months ahead," said BTIG Chief Technical Strategist Katie Stockton.
However, she said based on other technical indicators "we would be wary of a lack of follow-through in the days ahead."
Intel and Yahoo are scheduled to report on Tuesday. Other early morning quarterly reports included Johnson & Johnson (JNJ), which closed up more than 1.5 percent after reporting earnings that beat, while revenue matched forecasts. The firm also raised its full-year forecast.
UnitedHealth (UNH) reported earnings that beat on both the top and bottom line, and raised its full-year forecast. The stock closed up 2.1 percent and was the second-top contributor to gains in the Dow.
In other corporate news, FBR rated the newly formed Liberty Media tracking stocks Liberty SiriusXM, Liberty Media (Frankfurt Stock Exchange: LM0-FF) as "outperform," noting both stocks are trading a "meaningful discounts" to their "sum-of-the-parts" values. Shares were nearly 6.8 percent in the close.
In economic news, housing starts fell a more-than-expected 8.8 percent in March to a seasonally adjusted annual pace of 1.09 million units, the lowest level since October, according to Reuters, citing the Commerce Department. Building permits dropped 7.7 percent to a 1.09 million-unit rate last month, the lowest level since March last year.
Treasury yields traded higher, with the 2-year yield (U.S.:US2Y) at 0.76 percent and the 10-year yield (U.S.:US10Y) near 1.79 percent.
The U.S. dollar index was about 0.4 percent lower, with the euro near $1.136 and the yen at 109.18 yen against the greenback.
Gold futures settled $19.30 higher, at $1,254.30 an ounce, after earlier hitting its highest since April 13.
Late Monday, Boston Fed President Eric Rosengren reiterated in a Reuters report that the Federal Reserve is set hike interest rates more rapidly than priced into futures markets, which see only one modest rate hike in each of the next few years.
The Dow Jones industrial average (Dow Jones Global Indexes: .DJI) closed up 49.44 points, or 0.27 percent, at 18,053.60, with Goldman Sachs leading advancers and IBM the greatest decliner.
The S&P 500 (^GSPC) closed up 6.46 points, or 0.31 percent, at 2,100.80, with materials leading eight sectors higher and consumer discretionary and information technology the only decliners.
The Nasdaq (^IXIC) composite closed down 19.69 points, or 0.40 percent, at 4,940.33.
The CBOE Volatility Index (VIX) (^VIX), widely considered the best gauge of fear in the market, held steady just above 13. Earlier, the VIX fell below 13 to its lowest since Oct. 28.
About seven stocks advanced for every three decliners on the New York Stock Exchange, with an exchange volume of 885 million and a composite volume of 3.8 billion in the close.
—CNBC's Peter Schacknow and Reuters contributed to this report
On tap this week:
Earnings: Intel, Yahoo, Discover Financial, Intuitive Surgical, Interactive Brokers, VMWare
Earnings: American Express, Coca-Cola, Abbott Labs, EMC, SLM, F5 Networks, Mattel, United Continental, Qualcomm, Stryker, Las Vegas Sands, Tractor Supply, Yum Brands, U.S. Bancorp, Illinois Tool Works, Canadian Pacific Railway, St. Jude Medical
10 a.m. Existing home sales
Earnings: Alphabet, Microsoft, General Motors, Visa, Starbucks, Bank of NY Mellon, Biogen, Under Armour, Southwest Air, Stanley Black and Decker, Imax, Novartis, Union Paicific, DR Horton, Fifth Third, Johnson Controls, Pulte Group, Polaris, Alaska Air, Verizon, Travelers, E*Trade, Norfolk Southern, Boston Beer
8:30 a.m. Initial claims
8:30 a.m. Philadelphia Fed survey
9 a.m. FHFA home prices
Earnings: General Electric, Caterpillar, McDonald's, Honeywell, AutoNation, American Airlines, Synchrony Financial, Kimberly-Clark, SunTrust, LyondellBasell, Steve Madden, Daimler
9:45 a.m. Manufacturing PMI
*Planner subject to change.
More From CNBC.com:
- Street Explained: See through the earnings games
- CFO: Why J&J's three units are best as one company
- How one trader plans to make millions on Facebook
More From CNBC