The and Nasdaq composite rose on Wednesday as some of the biggest U.S. companies reported strong quarterly results, lifting investor sentiment.
The broad index gained 0.1 percent to close at 2,708.64, while the tech-heavy Nasdaq climbed 0.2 percent to finish the session at 7,295.24. The Dow Jones industrial average fell 38.56 points to 24,748.07, however, as steep losses from IBM pushed the 30-stock index lower.
Rail transportation company CSX posted quarterly results that easily beat Wall Street estimates, boosted by a series of cost-cutting measures. CSX shares rose 7.8 percent and posted their biggest gain since Jan. 17, when it gained more than 20 percent.
United Airlines also posted better-than-expected results for the first quarter, sending its stock higher by nearly 5 percent.
Morgan Stanley reported a record profit and revenue for the first quarter, as its trading business did better than expected. Shares of the investment bank climbed more than 1 percent before closing flat.
The corporate earnings season has gotten off to a strong start. According to Thomson Reuters I/B/E/S, 79 percent of the S&P 500 companies that had reported through Wednesday morning surpassed earnings expectations. Meanwhile, 83 percent of those companies topped sales estimates.
"These are just slam dunk earnings," said Nick Raich, CEO of The Earnings Scout. "If you want to be bearish on stocks, don't look to earnings."
IBM reported Tuesday earnings and revenue that topped analyst expectations, but investors were left disappointed with the company's forward-looking guidance. Shares of IBM fell 7.5 percent and had their worst day since Oct. 24, 2014, when they dropped 7.6 percent.
"Beating on the top and bottom line ... just won't cut it for the market," said Tom Essaye, founder of The Sevens Report. "The business metrics need to be strong" and guidance can not be be disappointing.
Elsewhere, oil prices surged 2.9 percent and hit their highest level in more than three years after a big drawdown in U.S. crude stockpiles. The move higher in oil lifted shares of energy companies, as Chevron and Exxon Mobil rose more than 1 percent each. The Energy Select Sector SPDR Fund (XLE) rose 1.6 percent and posted its first four-day winning streak since late December.
Wednesday's climb in the stock market comes after a strong finish on Tuesday, as the major indexes rallied on strong earnings from companies like UnitedHealth and Netflix.
On the economic data front, the Federal Reserve said in the latest Beige Book the U.S. economic outlook remains positive, but noted that steel prices are rising due to tariffs.