Stocks close higher as oil rises after Fed

U.S. stocks closed higher Wednesday, helped by a rise in oil prices, following the release of the Federal Reserve's statement and economic projections.

The major averages closed off session highs, with the Dow Jones industrial average up about 74 points after earlier rising 127 points. Caterpillar, IBM and Chevron were among the top contributors to gains. Goldman Sachs was the greatest contributor to declines.

"Clearly oil is playing a role," said John Bredemus, vice president, Allianz Investment Management. He also attributed gains in stocks to "a little more clarity around what the Fed is going to do."

The Federal Reserve left rates unchanged and reduced projections for the number of rate hikes in 2016 to two from four, a greater drop than many expected.

U.S. crude oil futures settled up $2.12, or 5.8 percent, at $38.46 a barrel, with traders attributing some of the last leg higher to the Fed announcement. Oil gained after weekly crude oil inventories showed a smaller-than-expected build of 1.3 million barrels and following news producers will meet next month in Qatar to discuss a proposal to freeze output.

The central bank also cut its outlook for 2016 GDP growth to 2.2 percent from 2.4 percent previously.

Fed Chair Janet Yellen said in a press conference following the statement release that policymakers have not concluded inflation has seen a significant, lasting uptick.

"I think it's neutral for stocks," said Ilya Feygin, managing director and senior strategist at WallachBeth Capital, "because it's negative for the financial sectors and (the Fed) brought down their measures of economic growth by 0.2."

Read MoreLive blog: Oil jumps, dollar falls after Fed statement

The S&P 500 briefly gave up a post-Fed spike as financials and health care weighed, before closing about half a percent higher as materials and energy led advancers.

The U.S. dollar index turned lower after the Fed statement to fall more than 1 percent, with the euro topping $1.12 to hit its highest since Feb. 15. The yen was near 112.59 yen against the greenback. The dollar index fell near 95.5, its lowest level since Feb. 12, after earlier topping 97 for its highest since March 10.

Gold futures for April delivery jumped more than 2 percent, or $30, to $1,261 an ounce in electronic trade post-Fed, following a slightly lower settle earlier in the day.

Read MoreHere's what changed in the new Fed statement

The iShares MSCI Emerging Market ETF (EEM) surged following the Fed announcement to close 2 percent higher.

"Definitely the news is somewhat emerging market and commodity-positive, but if the equity market reverses, they'll take down the gains as well," Feygin said.

Treasury yields turned lower, with the 2-year yield falling below 0.90 percent to 0.85 percent and the 10-year yield at 1.91 percent.

After the Fed statement release, the CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, fell below 15.5 to its lowest intraday level since Dec. 24. ( Tweet This )

The Nasdaq composite outperformed as Apple and Microsoft gained. The iShares Nasdaq Biotechnology ETF (IBB) gave up attempts at gains to close half a percent lower, following a 3.8 drop on Tuesday.

Read MoreWall Street checks out of coal mines

The major averages opened lower before attempting slight gains in morning trade. Treasury yields climbed in morning trade, with the 2-year yield briefly topping 1 percent for its highest since Jan. 8, after inflation and housing data.

"We're now pricing in more rate hikes so that's weighing on things," Peter Boockvar, chief market analyst at The Lindsey Group, said of the morning rise in yields. "The data says (the Fed) should move. The market just doesn't expect it."

In morning trade, the spread between the 2-year and 30-year Treasury yield narrowed to its tightest since Dec. 26, 2008, during the financial crisis.

Ex-food and energy, the so-called core CPI rose 0.3 percent in February for a 2.3 percent rise over the 12 months through February, Reuters said. The overall consumer price index showed a 0.2 percent decline.

Symbol
Name
Price
 
Change
%Change
DJIA
---
S&P 500
---
NASDAQ
---

In other economic news, housing starts rose 5.2 percent in February.

Industrial production declined 0.5 percent in February, with capacity utilization at 76.7 percent.

Weekly mortgage application volume fell 3.3 percent on a seasonally adjusted basis, but still nearly 21 percent higher year-over-year, according to the Mortgage Bankers Association.

Read More Early movers: VRX, CMG, LNKD, BTU, GPS, TWC, AAPL & more

The Dow Jones industrial average closed up 74.23 points, or 0.43 percent, at 17,325.76, with Caterpillar the top gainer and Pfizer leading decliners.

The S&P 500 closed up 11.29 points, or 0.56 percent, at 2,027.22, with materials leading eight sectors higher and financials and health care the only decliners.

The Nasdaq composite closed up 35.30 points, or 0.75 percent, at 4,763.97.

About four stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 939 million and a composite volume of about 4.0 billion.

Gold futures for April delivery settled down $1.20 at $1,229.80 an ounce.

On tap this week:

Thursday

Bank of England monetary policy announcement and minutes

Earnings: Tencent, Michaels Cos., Intl. Game Technology, Lands' End, Adobe Systems

8:30 a.m.: Jobless claims

8:30 a.m.: Philly Fed business outlook survey

8:30 a.m.: Current account

10 a.m.: JOLTS

10 a.m.: Leading indicators

10:30 a.m.: Natural gas inventories

4:30 p.m.: Fed balance sheet/Money supply

Friday

Quadruple Witching

Earnings: Tiffany

9 a.m.: New York Fed President William Dudley speaks

10 a.m.: Consumer sentiment

10 a.m.: Atlanta Fed business inflation expectations

11 a.m.: Boston Fed President Eric Rosengren speaks

1 p.m.: Oil rig count

1:30 p.m.: St. Louis Fed President James Bullard

*Planner subject to change.

More From CNBC.com: