US Markets

Stocks close off session highs in extended post-Yellen rally

Rally after speech heard 'round the world
VIDEO1:4501:45
Rally after speech heard 'round the world
Pisani: Weak dollar's impact around the world
VIDEO3:3903:39
Pisani: Weak dollar's impact around the world
Fed's Evans: Yellen laid out all the right issues
VIDEO2:4602:46
Fed's Evans: Yellen laid out all the right issues
Yellen: Deciphering the dove
VIDEO2:4302:43
Yellen: Deciphering the dove
Yellen strikes cautious tone
VIDEO2:0702:07
Yellen strikes cautious tone

U.S. stocks closed higher Wednesday, with tech stocks leading, as equities extended Tuesday afternoon's gains following Fed Chair Janet Yellen's cautious stance on the path of tightening.

"It's a continuation to what we saw yesterday," said JJ Kinahan, chief strategist at TD Ameritrade. He also noted that as the Friday jobs report neared traders would likely be setting up positions.

The major averages closed well off session highs, with the Dow Jones industrial average up 83 points after earlier gaining 157 points. Oil gave up sharp gains, while biotech stocks reversed to close lower.

The S&P 500 and Dow still closed at their highest level of 2016 for the second day in a row, after touching fresh highs for the year so far in intraday trade.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held around 13.5 after falling near 13, its lowest since Oct. 28. (Tweet This)

Pipelines run toward oil storage tanks in Cushing, Oklahoma.
Oil inventories spook investors, WTI ends at $38.32
Dollar tumbles in aftermath of Yellen's dovish comments
U.S. Federal Reserve Chair Janet Yellen
US Treasury yields hold higher after Yellen, notes sale
Gold Coins and Credit Suisse gold bar
Gold slides after post-Yellen rally as safe-haven demand eases

"People are just trying to gain any kind of insight into the Federal Reserve," said Robert Pavlik, chief market strategist at Boston Private Wealth. "But right now your middle of the lineup and your clean-up hitter, Janet Yellen, speaking about keeping rates lower, that feeds a risk-on trade that keeps the dollar lower and helping commodity prices."

"I think people are chasing the market and it's not based on fundamentals," he said.

Traders also attributed some Wednesday's price action to flows related to the end of the quarter, which concludes Thursday. The S&P and Dow are on pace for quarterly gains of about 1 percent or more, with the Dow tracking for its biggest quarterly recovery since 1933.

The Nasdaq composite is on pace for a quarterly loss of more than 2.7 percent but closed above its 200-day moving average for the first time since Dec. 31.

Major averages 5-day performance


The iShares MSCI Emerging Markets ETF (EEM) gained 1 percent on Wednesday to close above its 200-day moving average for the first time since June 2015.

"The market is overinterpreting this as, we're going to see one hike this year or no hikes this year," said Brian Nick, head of tactical asset allocation at UBS Wealth Management Americas.

"The balance of the year is going to be sink or swim depending how earnings come in," he said.

Read MoreGet ready for a rough corporate earnings season

Early Wednesday, Chicago Fed President Charles Evans said on CNBC's "Squawk Box" "the threshold for having confidence that inflation will sustainably move up to our 2 percent inflation target, is pretty high, that hurdle is pretty high. I'd be surprised if we met that condition myself in April."

Later, speaking to the Forecasters Club of New York, Evans said in a Reuters report that a "very shallow" series of interest rate hikes over the next few years is appropriate to buffer the U.S. economy from outside shocks and the risk of inflation slipping too low. He raised his inflation forecast for this year to 1.6 percent — though he still expects it to take up to three years to hit the Fed's 2-percent target, Reuters said.

Evans, an alternate member of the Federal Open Market Committee, also said a slow succession of U.S. rate hikes is warranted given the early-year bout of market volatility and the likelihood that such episodes will be more frequent, according to Reuters.

Read MorePro Uncut: Full interview with Fed's Charles Evans

The U.S. dollar index held off session lows with a decline of 0.35 percent, still its third-straight day of declines. The euro hit a high of $1.1364 against the dollar, its highest since Feb. 11. The yen was near 112.41 yen against the greenback. The dollar index is on pace for a quarterly decline of nearly 4 percent.

U.S. crude oil futures settled up 4 cents, or 0.1 percent at $38.32 a barrel. WTI spiked more than 3.5 percent after weekly inventories showed a build of 2.3 million barrels.

"People still couple oil with global growth potential," said Kevin Mahn, president and chief investment officer at Hennion & Walsh Asset Management. "I don't think that's fair."

The hit its lowest since February at 0.757 percent. The 10-year yield held higher around 1.83 percent.

"I think it's a bit of a hangover from Yellen's speech yesterday afternoon, which of course appeared to cap the number of rate hikes for 2016 at two," said Guy LeBas, chief fixed income strategist at Janney Montgomery Scott.

In an address to The Economic Club of New York, Yellen said Tuesday that economic readings are mixed and it is appropriate to proceed cautiously in adjusting policy.

"The future path of the federal funds rate is necessarily uncertain because economic activity and inflation will likely evolve in unexpected ways," she said, noting risks to the economic outlook from global developments, particularly continued uncertainty around China's transition.

Read MoreYellen push back at hawks creates confusion

Ahead of Friday's employment report, ADP said 200,000 positions were added in March.

"The ADP report probably speaks to a decent non-farm payrolls report on Friday," Pavlik said.

Apple closed up 1.75 percent, off session highs but extending Tuesday's rally.

Cowen upgraded the stock on Wednesday to "outperform" from "market perform" and raised the price target to $135, based on expectations that year-over-year comparable sales and forward estimates have bottomed. Cowen also noted likely upside from the coming upgrade cycle, potential use of OLED technology and valuation.

Separately, the iPhone maker is partnering with Major League Baseball to help with analytics by providing all teams with the iPad Pro and a specialized app.

Information technology, consumer discretionary and financials led advancers in the S&P 500, while health care ended a touch lower as one of the few decliners.

MetLife rose 5.35 percent, AIG gained 2.12 percent, and Prudential Financial advanced 2 percent to lead financials. A U.S. district judge struck down on Wednesday the designation made by the heads of the country's financial regulatory agencies that major insurer MetLife is systemically important to the U.S. financial system, Reuters said.

Major U.S. Indexes


European stocks closed higher, with the German DAX up 1.6 percent.

Asian stocks closed mostly higher, with the Shanghai composite up more than 2.7 percent and the Hang Seng up more than 2 percent. The Nikkei 225 closed down 1.3 percent.

On Tuesday, the S&P 500 and Dow Jones industrial average recovered from a lower open to close at their highest levels of the year so far and in positive territory for 2016.

Read MoreEarly movers: LULU, AAPL, STT, GE, VRX, RH, BA, SONC, PLAY & more

The Dow Jones industrial average closed up 83.55 points, or 0.47 percent, at 17,716.66, with Visa leading advancers and Boeing the greatest decliner.

The closed up 8.94 points, or 0.44 percent, at 2,063.95, with information technology leading seven sectors higher and utilities the greatest decliner.

The Nasdaq composite closed up 22.67 points, or 0.47 percent, at 4,869.29.

About three stocks advanced for every two decliners on the New York Stock Exchange, with an exchange volume of 823 million and a composite volume of nearly 3.6 billion

Gold futures for June delivery settled down $8.90 at $1,228.60 an ounce.

On tap this week:

Thursday

8:30 a.m.: Jobless claims

9:30 a.m.: Chicago Fed President Charles Evans

9:45 a.m.: Chicago PMI

5 p.m.: New York Fed President William Dudley

Friday

March vehicle sales

8:30 a.m.: Employment report

9:45 a.m.: Manufacturing PMI

10 a.m.: ISM manufacturing

10 a.m.: Construction spending

10 a.m.: Consumer sentiment

1 p.m.: Cleveland Fed President Loretta Mester

*Planner subject to change.

More From CNBC.com: