US Markets

Dow closes at highest since July

Cashin: Oil turns the Dow around
VIDEO3:5103:51
Cashin: Oil turns the Dow around
Stocks push higher
VIDEO3:3803:38
Stocks push higher
Why stocks have rallied: Pisani
VIDEO2:5302:53
Why stocks have rallied: Pisani
What oil's comeback means for stocks
VIDEO4:2304:23
What oil's comeback means for stocks
Saudi Aramco IPO
VIDEO2:0802:08
Saudi Aramco IPO

U.S. stocks closed higher Wednesday but well off session highs as declines in consumer staples and utilities weighed.

The Dow Jones industrial average closed up about 43 points at its highest since July 20, 2015. Earlier, the index added more than 100 points to hit its highest since June 23, 2015.

"You're running into a lot of resistance here. We didn't sell off on the decline in oil prices. Now we rally on the rise in oil prices. A lot of confusion, I have to say," said Peter Boockvar, chief market analyst at The Lindsey Group. He also noted the afternoon strength in the U.S. dollar may also have pressured stocks.

The U.S. dollar index was more than half a percent higher, with the euro near $1.129 and the yen at 109.79 yen against the greenback.

U.S. crude oil futures for May delivery settled up $1.55, or 3.77 percent, at $42.63 a barrel, for its highest close of the year so far. After the settle, the contract rolled to June, which settled up 4.03 percent at $44.18 a barrel.

Stocks are rising with "people putting money to work during earnings season, continued short covering and more of a risk-on sentiment around the world right now," said Peter Coleman, head trader at Convergex. He noted some support for stocks from the rise in oil prices, but pointed out the correlation has declined recently.

US oil surges 3.77 pct, posts highest close this year
US Treasurys fall as oil reverses
Dollar gains against euro ahead of ECB meeting
An employee arranges one kilogram gold bars for a photograph at the YLG Bullion International headquarters in Bangkok, Thailand, on Jan. 13, 2016.
Gold steadies as dollar firms; silver hits 11-month high

The S&P 500 clung to slight gains in the close to end at its highest since Dec. 1. Financials and energy led advancers, while utilities fell 2.4 percent and consumer staples closed nearly 1.4 percent lower to lead decliners.

Treasury yields turned higher in midday trade, with the hitting 0.81 percent and the 10-year yield rising to 1.859 percent, their highest since late March.

"I think it was a combination of stronger equity markets and higher oil prices," said Sharon Stark, fixed income strategist at D.A. Davidson.

WTI pared losses and turned higher as oil prices found support from a late-morning Bloomberg report, citing Iraq, that OPEC and other producers would possibly meet in Russia in May to discuss an output freeze proposal. Bloomberg later reported that Russia said there was no agreement on a meeting.

Traders also attributed oil's gains to the EIA's mid-morning report that raised expectations of curbing oversupply with a decline in U.S. production and a lower-than-forecast crude inventory build of 2.1 million barrels. Volatility around the post-settle contract rollover was also a factor.

Read MoreDow, other key stocks form bullish 'golden cross'

The Dow failed to hold 18,100 in the close, with Boeing, Caterpillar and Procter & Gamble contributing the most to declines. Goldman Sachs and UnitedHealth contributed the most to gains.

"We're digesting first-quarter earnings (mostly beating) relatively lowered expectations and the market is telling us we're in an environment where there's no panic about the first quarter and beyond," said Tom Wright, director of equities at JMP Securities.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held around 13 after earlier falling to 12.5, its lowest since August 10, 2015. (Tweet This)


"We seem to have a fine balance between the tug of war that is crude prices and earnings that are better than worst case scenario," said Art Hogan, chief market strategist at Wunderlich Securities.

"Right now earnings are winning that tug of war," he said. "To me it feels like correlation between oil and the S&P (breaks down) above $40."

Earlier, oil traded lower but held mostly above $40 a barrel. WTI turned lower in late trade Tuesday after the American Petroleum Institute reported a surprise build and news of settlement in Kuwait's oil worker strike.

Coca-Cola reported earnings that beat slightly on both the top and bottom line. Worldwide case volume was up two percent, slightly below analysts' forecasts. The stock closed about 4.8 percent lower, off lows.

Intel posted earnings that topped expectations, with revenue essentially in line. However, revenue guidance missed expectations and the firm cut its full-year profit margin outlook. Intel also announced it would cut up to 12,000 jobs and that Chief Financial Officer Stacy Smith would leave that post to lead the company's sales efforts. The stock closed nearly 1.3 percent higher.

Read MoreAnalysts raise concern on Boeing aircraft profitability

The major averages struggled for gains in morning trade Wednesday before turning higher, with the S&P 500 and Dow trading closing about 1.5 percent or less below their 52-week intraday highs touched last May.

The "market looks a little exhausted right now. We've encountered some key resistance areas," said John Caruso, senior market strategist at RJO Futures.

"I do think volatility is due to increase here relatively soon. I think there's a lot of question marks hanging into the balance," he said.

On Tuesday, the S&P 500 topped the psychologically key 2,100 level for the first time since early December, while the Dow held above the 18,000 level.

"As the market continues to grind higher and it refuses to sell off, that means the underlying bid is alive and well," said Adam Sarhan, CEO of Sarhan Capital.

Read MoreWhat a Brexit could mean for US banks

In economic news, existing home sales surged 5.1 percent to a seasonally adjusted annual rate of 5.33 million units in March. February's sales pace was revised slightly down to 5.07 million units from the previously reported 5.08 million units.

Major U.S. Indexes


Overseas, European stocks closed about half a percent higher or more, with the STOXX Europe 600 Banks index outperforming with gains of 2.2 percent. The index is still more than 15 percent lower year-to-date but up 6.45 percent for the month so far.

The Nikkei 225 closed almost 0.2 percent higher while most Asian stocks ended lower. The Shanghai composite fell 2.3 percent, amid reports that China's central bank may not ease as aggressively this year.

Read MoreEarly movers: KO, DISH, TUP, NLSN, GOOGL, INTC, GPN, VMW, YUM & more

The Dow Jones industrial average closed up 42.67 points, or 0.24 percent, at 18,096.27, with Goldman Sachs leading advancers and Coca-Cola the greatest decliner.

The closed up 1.60 points, or 0.08 percent, at 2,102.40, with financials leading five sectors higher and utilities the greatest laggard.

The Nasdaq composite closed up 7.80 points, or 0.16 percent, at 4,948.13.

The Russell 2000 closed up 0.18 percent at its highest level of the year so far but is the only major U.S. index still in correction territory, or more than 10 percent below its 52-week intraday high.

Advancers were a step ahead of decliners on the New York Stock Exchange, with an exchange volume of 966 million and a composite volume of 4.1 billion in the close.

Gold futures for June delivery settled up 10 cents at $1,254.40 an ounce.

—CNBC's Peter Schacknow contributed to this report.

On tap this week:

Thursday

Earnings: Alphabet, Microsoft, General Motors, Visa, Starbucks, Bank of NY Mellon, Biogen, Under Armour, Southwest Air, Stanley Black and Decker, Imax, Novartis, Union Paicific, DR Horton, Fifth Third, Johnson Controls, Pulte Group, Polaris, Alaska Air, Verizon, Travelers, E*Trade, Norfolk Southern, Boston Beer

8:30 a.m. Initial claims

8:30 a.m. Philadelphia Fed survey

9 a.m. FHFA home prices

Friday

Earnings: General Electric, Caterpillar, McDonald's, Honeywell, AutoNation, American Airlines, Synchrony Financial, Kimberly-Clark, SunTrust, LyondellBasell, Steve Madden, Daimler

9:45 a.m. Manufacturing PMI

*Planner subject to change.

More from CNBC.com: