Wall Street was torn in two on Wednesday with the energy sector marching the Dow Jones Industrial Average higher, while health care and tech weighed on the Nasdaq.

The Dow added 0.01% to close at 19,123, less than 30 points from its record close of 19,152. The S&P 500 declined 0.26% and the Nasdaq fell 1.05%. The S&P 500 and Dow reached intraday records earlier in the session.

Crude oil surged Wednesday after the Organization of Petroleum Exporting Countries reached an agreement to trim production by 1.2 million barrels a day. OPEC currently produces 33.6 million barrels a day, a record high. The deal hinges on non-OPEC producers committing to reduce output by 600,000 barrels a day, half of which Russia has reportedly already agreed to deliver. The cut is OPEC's first since 2008.

Hopes for a deal had gone back and forth as individual OPEC members raised doubt over their cooperation. Some members, including Iran, were hesitant to cede market share and suggested the countries that had raised production in recent months should bear the burden of a cut.

"The failed attempts at a deal over the past year as well as the fragile state of public finances in most OPEC member countries mean that the oil market is likely to test OPEC compliance with the deal," Jens Nrvig Pedersen, senior analyst at Danske Bank, wrote in a note. "If it is implemented it may push oil prices a bit higher."

In domestic news, crude inventories in the U.S. showed a surprise decline in the past week. Crude stocks fell by 900,000 barrels in the past week, according to the Energy Information Administration. Analysts had anticipated inventories to rise by 640,000 barrels.

West Texas Intermediate crude oil jumped 9.3% to close at $49.44 a barrel on Wednesday. Crude was up 5.5% for the month.

Oil stocks got a burst of energy following the reported OPEC deal. Dow components Exxon Mobil (XOM) - Get Report and Chevron (CVX) - Get Report boosted the blue-chip index, while Royal Dutch Shell (RDS.A) , ConocoPhillips (COP) - Get Report , Hess (HES) - Get Report , and BP (BP) - Get Report were also sharply higher. The Energy Select Sector SPDR ETF (XLE) - Get Report rose 5%.

Valeant Pharmaceuticals (VRX) was a big drag on the health care sector after talks to sell its Salix unit broke down, according to a report. The company had previously been in negotiations with Japanese company Takeda to sell its Salix gastrointestinal drugs for roughly $10 billion.

Biotech stocks were also lower on Wednesday. Celgene (CELG) - Get Report , AbbVie (ABBV) - Get Report and Amgen (AMGN) - Get Reporteach saw losses, while the Health Care SPDR ETF (XLV) - Get Report sank nearly 1% and the iShares NASDAQ Biotechnology Index ETF (IBB) - Get Report slid 2.2%.

Autodesk (ADSK) - Get Report led software companies lower after offering a disappointing outlook. The design software developer anticipates a current-quarter adjusted loss of 32 cents to 39 cents a share, while adjusted fiscal losses are expected between 54 cents and 61 cents a share. Industry peers including Adobe (ADBE) - Get Report , Citrix (CTRX) , Microsoft (MSFT) - Get Report and Red Hat (RHT) - Get Report were also lower. 

The Federal Reserve's "Beige Book," an anecdotal snapshot of economic conditions in the 12 Fed districts, backed up recent data showing improvements in the U.S. economy. The central bank said the economy continued to expand, though there were no signs of an extra bump in activity after the U.S. presidential election. San Francisco, Minneapolis and Boston reported a "moderate pace" of growth, Atlanta, Chicago, St. Louis and Dallas showed "modest growth" and Philadelphia, Cleveland and Kansas City saw a "slight pace."

Dallas Fed President Robert Kaplan backed up speculation of a rate hike in December, arguing Wednesday that the U.S. economy had moved steadily toward full employment and that the Fed's 2% inflation target was in sight. 

"I would advocate that we take action to remove some amounts of accommodation," Kaplan said in remarks prepared for delivery in New York. Kaplan also reminded that increases should be made "gradually and patiently."

Cleveland Fed President Loretta Mester, a noted hawk on the Federal Open Market Committee, argued on Wednesday that a rate hike would help, not hurt, the U.S. economic recovery. A small increase in interest rates would be "appropriate" as it will "help prolong the expansion," Mester said in remarks in Pittsburgh, Pennsylvania.

A December rate hike has a high probability among Wall Street pundits with any doubt after Donald Trump's recent election as U.S. president quickly evaporating. The chances of a December rate hike sit at 98%, according to CME Group fed funds futures.

Banking stocks got a boost after President-elect Donald Trump nominated Steve Mnuchin as Treasury secretary. Mnuchin, a veteran banker and former executive of Goldman Sachs, suggested he would roll back portions of the Dodd-Frank financial rules. The 2010 legislation was introduced as a measure to ensure banks were strong enough to weather future financial crises. Mnuchin told CNBC that the legislation was "too complicated and cuts back lending."

Goldman Sachs (GS) - Get Report , JPMorgan (JPM) - Get Report , Morgan Stanley (MS) - Get Report , Bankof America (BAC) - Get Report and Citigroup (C) - Get Report were all sharply higher. The Financial Select Sector SPDR ETF (XLF) - Get Report rose 1.3%.

Citigroup is a holding in Jim Cramer'sAction Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sellsC?Learn more now.

Pending home sales for October came in far weaker than anticipated as constrained inventory dragged on the headline number. Sales of homes in which a deal has been made but contract not yet signed rose just 0.1% to 110.0, below an anticipated 0.8% increase. Sales had risen 1.5% in September.

Personal income rose at a faster-than-expected pace in October, according to the Bureau of Economic Analysis. Incomes in the U.S. increased 0.6% in October, higher than 0.4% growth expected, and double the increase seen in September. The increase was its largest gain since April. Consumer spending increased 0.3% in October and was revised to a 0.7% gain in September from 0.5%.

The U.S. private sector added 216,000 jobs in November, according to the ADP National Employment Report. Analysts had anticipated a far-weaker reading of 165,000 jobs. The official jobs report for November, one of the most closely watched pieces of data for the month, will be released on Friday. Economists anticipate 180,000 jobs to have been added to the U.S. economy in November and for the unemployment rate to hold at 4.9%.

Business conditions in the Chicago region reached their best level since January 2015, according to the latest reading of Chicago PMI. The index reached 57.6 in October from 50.6 in September. Analysts had anticipated the index to rise to 52.