The S&P 500 inched higher in mixed trading Wednesday as a rally in crude helped the energy sector.

The S&P 500 was up 0.06%, the Dow Jones Industrial Average slid 0.2%, and the Nasdaq added 0.3%. The Dow was on track to close out the day with losses for the ninth session of 10. 

Crude oil prices rose on Wednesday after domestic inventories added 900,000 barrels over the past week, according to the Energy Information Administration. Analysts had expected a higher increase after the American Petroleum Institute showed a rise of 1.9 million barrels.

Crude closed at its highest level in a week on Tuesday after production hurdles in Libya eased pressure on high global output. A militia in Libya shut down pipelines on Monday in protest of wages.

West Texas Intermediate crude was up 2.3% to $49.49 a barrel on Wednesday.

The energy sector was the top performer on Wednesday. Chesapeake Energy (CHK) - Get Report , Whiting Petroleum (WLL) - Get Report , Petrobras (PBR) - Get Report , and Hess (HES) - Get Report were all higher, while the Energy Sector Sector SPDR ETF (XLE) - Get Report added 1.3%.

Financials stocks were under pressure again on Wednesday, dragging on the Dow, as losses continued after Tuesday brought much-needed relief. Dow components Goldman Sachs (GS) - Get Report and JPMorgan (JPM) - Get Report were slightly lower, while lesser-known stocks including Fang Holdings (SFUN) - Get Report , Mizuho Financial (MFG) - Get Report and ORIX (IX) - Get Report declined.

Boston Federal Reserve President Eric Rosengren struck a hawkish tone in comments to the Boston Economic Club on Wednesday. Rosengren said the Fed should hike rates three more times this year and that the central bank should move away from its data dependence to a bias toward tightening its monetary policy.

Chicago Fed President Charles Evans said on Wednesday that he supports one or two more interest rate hikes in 2017, in-line with the central bank's target of two more this year. Evans also said the likelihood of sustainable 3% to 4% GDP for the U.S. economy was low, even as Donald Trump champions that kind of growth.

Amazon (AMZN) - Get Report  and Alphabet (GOOGL) - Get Report led the tech sector. Amazon announced late Tuesday that it would add 1,000 full-time jobs when it opens a new fulfillment center in Clear Brook, Va. The e-commerce company already employs 3,500 full-time positions at three sites in the state. Shares rose 1.5% to a record high.

Alphabet was initiated with an overweight rating and $1,065 price target at Barclays. The company can generate 20% annual sales and earnings growth for the next few years, Barclays said. The stock rose 0.8%.

Alphabet is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells GOOGL? Learn more now.

TheStreet Recommends

The United Kingdom took the expected first step to formally remove itself from the European Union, a relationship that has lasted more than four decades. U.K. Prime Minister Theresa May activated Article 50 of the Lisbon Treaty Wednesday morning by notifying European Council President Donald Tusk by way of letter. The notification kicks off two years of negotiating trade, immigration, and other economic deals between the U.K. and the EU.

"We all want to see a Britain that is stronger than it is today," May said in a statement. "We all want a country that is fairer so that everyone has the chance to succeed. We all want a nation that is safe and secure for our children and grandchildren."

The U.K. voted in favor of "Brexit" last summer in a shock win that rocked markets at the time. However, global markets mostly have readjusted to the new reality just as they did following Donald Trump's surprise election win in November. Analysts note that the long lead time heading into Article 50 means that markets have mostly priced in the move by Wednesday. 

"My conversations with EU officials in Brussels last week made clear there is now less appetite in the EU to punish Britain; the continent needs all the friends it can muster, in light of frosty (and, arguably, belligerent) signals from the Trump administration," said Patrick Chovanec, chief strategist at Silvercrest Asset Management and an adjunct professor at Columbia University's School of International and Public Affairs.

The Dow ended an eight-session losing streak on Tuesday with a triple-digit gain, clawing back from some of the heavy losses seen over the past week. The blue-chip index had suffered its longest losing streak since 2011 after closing Monday with its eighth day of losses in a row. The Dow hasn't had nine consecutive losses since the late 1970s. Stocks were under pressure for much of Monday as Wall Street contemplated the way forward for the Trump White House after its defeat on health care reform.

Pending home sales in the U.S. in February rose far faster than analysts anticipated, according to the National Association of Realtors. Sales rose by 5.5%, their highest level in almost a year and the second-best level in more than a decade. Analysts anticipated an increase of 2.4%. Pending home sales measure deals in which an agreement has been made but a contract not yet signed. 

Vertex Pharmaceuticals (VRTX) - Get Report  added 5% after releasing positive trial results from a treatment for cystic fibrosis. Two clinical trials involving tezacaftor, a second-generation "corrector" used in combination therapies to treat the underlying cause of cystic fibrosis, showed successful efficacy and safety data that also improves the performance of its existing drugs. 

Mylan (MYL) - Get Report fell 2% Wednesday afternoon after the U.S. Food and Drug Administration failed to approve its generic version of GlaxoSmithKline's asthma inhaler and medication Advair Diskus. Mylan said it would review the FDA's denial and update shareholders soon. 

Wells Fargo (WFC) - Get Reportagreed to pay $110 million to settle a class-action lawsuit over up to 2 million accounts its employees opened for customers without getting their permission, the bank said Tuesday. It's the first private settlement the bank has reached since it paid $185 million to federal and California authorities late last year. Authorities said bank employees, driven by high-pressure sales tactics, opened the bank and credit card accounts without customer authorization.

Wells Fargo is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells WFC? Learn more now.

Semiconductor developer Exar (EXAR) rocketed more than 22% higher on Wednesday after agreeing to be bought by MaxLinear (MXL) - Get Report for roughly $661.6 million in an all-cash deal. MaxLinear offered $13 a share for Exar, a 22% premium to its close on Tuesday. The deal is expected to close in the second quarter.   

China Energy has agreed to take a 19.9% stake in Cowen Group (COWN) - Get Report as part of a strategic partnership. China Energy will pay roughly $100 million for the position as well as a $175 loan for debt financing. The $18-a-share deal values Cowen at a 29.5% premium to its close on Tuesday. Cowen rose almost 7%.

Morgan Stanley (MS) - Get Report was upgraded to buy from hold at Deutsche Bank. The firm is optimistic about capital markets and an improvement in trading. 

Skechers (SKX) - Get Report fell 3.6% after being downgraded to negative from positive at Susquehanna. Analysts said they expect its domestic wholesale business to fall short of expectations on ongoing challenges. The shoe company is also facing increased competition from brands such as Adidas.