NEW YORK (Reuters) - The S&P 500 and Dow closed lower and the Nasdaq advanced on Wednesday as investors digested the latest round of earnings, while a drop in oil prices weighed on the energy sector.

IBM IBM.N sank 4.9 percent to $161.69 after the company reported a bigger-than-expected decline in revenue for the first time in five quarters. The stock was the biggest drag on the S&P and the price-weighted Dow.

“Usually the bigger names are the bellwethers, people look to them for some signals on the overall health, and sometimes the companies that report later that beat are lost in that shuffle,” said Peter Jankovskis, co-chief investment officer at OakBrook Investments LLC in Lisle, Illinois.

The energy sector .SPNY slumped 1.4 percent for its fifth drop in six sessions as oil prices settled nearly 4 percent lower.

U.S. data showed a counter-seasonal build in gasoline inventories and a smaller-than-expected decline in overall crude stocks and sent U.S. crude below the $52 a barrel mark for the first time in two weeks.

“Certainly oil has been weakening for a couple of days and that has been putting some pressure on things,” said Jankovskis.

Morgan Stanley MS.N rose 2 percent after posting a surge in quarterly profit, taking some of the sting out of a disappointing report from Goldman Sachs on Tuesday.

Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., April 19, 2017. REUTERS/Brendan McDermid

Of the 57 companies in the S&P 500 that have reported earnings through Wednesday morning, 75.4 percent have topped expectations, according to Thomson Reuters data, above the 71 percent average for the past four quarters.

Overall, profits of S&P 500 companies are estimated to have risen 10.8 percent in the quarter - the best since 2011.

The Dow Jones Industrial Average .DJI fell 119.13 points, or 0.58 percent, to 20,404.15, the S&P 500 .SPX lost 4.03 points, or 0.17 percent, to 2,338.16 and the Nasdaq Composite .IXIC added 13.56 points, or 0.23 percent, to 5,863.03.

The S&P 500 failed to climb above its 50-day moving average, a level which has acted as resistance since the benchmark index fell below it last week.

With Wall Street near record levels and worries over President Donald Trump’s ability to carry out his pro-growth promises, investors are hoping first-quarter earnings will be strong enough to justify pricey market valuations.

Mounting tension between North Korea and the United States, along with political uncertainty in Europe ahead of the French presidential elections, have also served to keep investors cautious.

Intuitive Surgical ISRG.O gained 6.4 percent at $807.94 to help lift the Nasdaq after the company reported higher-than-expected first-quarter revenue and profit. The stock was on track for its best day in nearly two years.

The U.S. economy expanded at a modest-to-moderate pace between mid-February and the end of March, but inflation pressures remained in check despite more difficulties in attracting and retaining workers, the Federal Reserve said.

Declining issues outnumbered advancing ones on the NYSE by a 1.12-to-1 ratio; on Nasdaq, a 1.52-to-1 ratio favored advancers.

The S&P 500 posted 21 new 52-week highs and 3 new lows; the Nasdaq Composite recorded 80 new highs and 39 new lows.

About 6.60 billion shares changed hands in U.S. exchanges, above the 6.31 billion daily average over the last 20 sessions.