The S&P 500 and Nasdaq Composite closed in positive territory Monday on the back of a rally in health-care stocks, while the Dow Jones Industrial Average retreated as uncertainties in the oil weighed on Wall Street.

The S&P 500 SPX, -1.11% rose 1.55 points to close at 2,058.69, led by a 1.1% gain in health-care stocks. The sector has been the third-worst performer on the index year-to-date, with a drop of 3%.

The Nasdaq Composite COMP, -1.07% added 14.05 points, or 0.3%, to finish at 4,750.21, with the iShares Nasdaq Biotechnology ETF IBB, +0.50% rallying 2.6%.

The Dow DJIA, -0.87% slid 34.72 points, or 0.2%, to close at 17,705.91.

Caterpillar Inc. CAT, -0.96% topped the Dow’s worst performers, falling 3.5%, while Chevron Corp. CVX, -0.73% and United Technologies Corp. US:UTX were also big decliners.

“Overall the market is a little on edge,” said Robert Pavlik, chief market strategist at Boston Private Wealth LLC. “There’s more talk [over] if the market that has been in a rally mode since February is running out of steam. There’s also talk if the energy rally is over.”

Volatility in stocks emerged after the weekend dismissal of Saudi Arabia’s powerful energy minister, Ali al-Naimi, sowed uncertainty about the country’s energy policy, said Paul Nolte, portfolio manager at Kingsview Asset Management. Al-Naimi will be succeeded by Khalid al-Falih, the chairman of the country’s state oil company, Saudi Aramco.

Crude-oil futures rose overnight, but turned sharply lower midmorning as the likelihood of a hoped-for production freeze from the Organization of the Petroleum Exporting Countries faded amid the reshuffling of Saudi Arabia’s power players, Nolte said.

The leadership change didn't shed any light on whether Iran will join in on the production-freeze pledge after only recently bringing its production back online. Anxiety centered on crude futures could persist as Iran faces a possible confrontation with Saudi Arabia over market share.

“There’s going to be no oil deal unless Iran is at the table,” Nolte said. “Iran would be happy to pump as much oil as they can.”

U.S.-traded crude CLM26, fell $1.22, or 2.7%, to settle at $43.44 a barrel.

Read:What the departure of Saudi Arabia’s al-Naimi means for oil prices

The uncertainty in the oil market is likely to discourage some investors from actively participating in the market for now, according to Diane Jaffee, senior portfolio manager at TCW.

“Oil is still a very important signal for the market, so investors will be sidelined until there is more clarity,” she said.

Market sentiment was further dampened by the belief that earnings are likely to remain weak with S&P 500 companies posting their lowest earnings-per-share growth rate since the financial crisis, according to James Abate, chief investment officer at Centre Asset Management LLC.

“The reported earnings growth rate for S&P 500 companies for first quarter is negative 5.1% and the revenue growth rate is negative 1.9%. Most importantly, profit-margin compression, which is typical in profit recessions, continued with no signs of a change in trend,” he said.

A story in China’s People’s Daily—seen as an official propaganda channel for the Communist Party—reported that the Chinese government won’t use excessive investment or rapid credit expansion to boost growth contributed to the subdued mood in the market.

Any sign of a reduction in the global stimulus efforts by central banks would be bad for risk appetite, Nolte said.

“Easy money and free money is what the markets are most interested in,” Nolte said. “So any time you say ‘we’re going to tighten things up a bit,’ the markets don’t take that well.”

Fed speakers:

Minneapolis Fed President Neel Kashkari on Monday said he supported the current dovish stance of the Federal Reserve, during a speech to the Economic Club of Minneapolis. The Fed president also said markets pay too much attention to statements from the U.S. central bank.

Chicago Fed President Charles Evans, speaking in London, said a stronger labor market is underpinning growth prospects. “The most important fundamental is the improvement of labor prospects. The U.S. labor market has been strong for quite some time,” he said.

San Francisco Fed President John Williams is expected to answer questions in a session on Quora—a question-and-answer website—at 6 p.m. Eastern.

On the data front, preliminary reports showed that while China’s oil imports rose, exports unexpectedly fell in April, and overall imports dropped by a sharper-than-expected 10.9% from a year earlier.

Stocks to watch:LendingClub Corp. LC, -3.32% shares plunged 35%—its largest one-day drop ever—after the online lender said Chief Executive Officer Renaud Laplanche would resign following a review of sales of $22 million in near-prime loans. The company named President Scott Sanborn as acting CEO as it posted adjusted earnings that fell short of expectations.

Tyson Foods Inc. TSN, -2.69% shares rose after earnings beat estimates. The company also raised its full-year adjusted earnings guidance.

Shanghai Disneyland test run ahead of June opening

China stocks drop; dollar rises: The Shanghai Composite Index SHCOMP, +2.06% tumbled on concerns over the economy on Monday, closing down 2.8%.

European stocks closed higher, with the Stoxx Europe 600 index SXXP, -0.66% rising 1%.

The dollar USDJPY, -0.01% gained against the euro and yen on the view that the modest rise in U.S. wage inflation could keep the Fed on course for interest-rate hikes. A stronger dollar punished gold prices US:GCM6, while copper US:HGK6 fell on China data.

While a stronger dollar is perceived as being bad news for stocks, Mike Antonelli, an equity sales trader at R.W Baird & Co., said the its recent strength looked to be temporary.

Read:Japan ready to intervene if yen jumps again, say finance minister Aso

—Barbara Kollmeyer contributed to this article.