U.S. stocks ended slightly lower on Wednesday, with major indexes giving up gains in choppy trade after the Federal Reserve raised U.S. interest rates, while a strong gain in the energy space helped limit losses.

The Fed raised interest rates and forecast at least two more hikes for 2018, signaling growing confidence that U.S. tax cuts and government spending will boost the economy and inflation and lead to more aggressive future tightening.

The hike was widely expected, and new Fed Chairman Jerome Powell said in a news conference after the rate-hike announcement that the U.S. central bank was trying to take the "middle ground" in raising rates.

"That's a Fed that really feels good about the economy, not only this year but into next year," said Jim Paulsen, Chief Investment Strategist at The Leuthold Group in Minneapolis.

"The initial response by equities was to go up because of the confidence the Fed seems to have in the economy. But with bond yields going up in anticipation of more hikes ..., that kind of scared the stock market again."

Financials, which benefit from a higher rate environment, briefly extended gains in the wake of the announcement but lost ground to close down 0.03 per cent. Names sensitive to higher rates such as utilities, down 0.39 per cent, and real estate, off 0.93 per cent, were under pressure.

Stocks were choppy following the Fed announcement, as yields on the 10-year U.S. Treasury note moved closer to 3 per cent, touching a one month high of 2.936 per cent.

Stocks have struggled this year while bond yield have moved higher.

Energy jumped 2.63 per cent and helped lift equities for a second straight session. Crude oil prices hit a six-week high after a surprise decline in U.S. inventories and as concern persisted over possible disruption to Middle East supply.

Markets participants are still trying to decipher the number of rate hikes this year - whether the Fed will stay at three increases as previously forecast by policy makers, or whether a fourth hike is possible.

The Dow Jones Industrial Average fell 44.96 points, or 0.18 per cent, to end at 24,682.31, the S&P 500 lost 5.01 points, or 0.18 per cent, to 2,711.93 and the Nasdaq Composite dropped 19.02 points, or 0.26 per cent, to 7,345.29.

Facebook (FB.O) shares gained 0.74 per cent to stem its recent sell-off over the past two days, which cost the social media company about US$50 billion in market value after reports of data misuse that raised broader questions about consumer privacy and the need for tougher regulation.

The company chief executive, Mark Zuckerberg, said Facebook "made mistakes" in a statement.

General Mills (GIS.N) slumped 8.85 per cent after the company cut its full-year profit forecast due to higher freight and commodity costs.

That weighed on other food companies, with Kellogg off 3.98 per cent, JM Smucker down 4.20 per cent and ConAgra off 2.94 per cent.

Southwest Airlines (LUV.N) fell 4.79 per cent after the carrier cut its forecast for a key revenue metric. Other airlines also fell, with the NYSE Arca Airline index down 1.09 per cent.

Advancing issues outnumbered declining ones on the NYSE by a 1.35-to-1 ratio; on Nasdaq, a 1.49-to-1 ratio favored advancers.

Volume on U.S. exchanges was 6.72 billion shares, compared to the 7.16 billion average over the last 20 trading days.

CANADIAN STOCKS

Canada's main stock index rose on Wednesday as higher oil prices boosted energy shares and the Federal Reserve signaled growing confidence in the U.S. economic outlook.

The Toronto Stock Exchange's S&P/TSX composite index closed up 58.92 points, or 0.38 per cent, at 15,675.28.

The TSX posted 8 new 52-week highs and 4 new lows. Across all Canadian issues there were 19 new 52-week highs and 34 new lows.

The largest percentage gainer on the TSX was BRP Inc (DOO.TO), which rose 9.5 per cent, while the largest decliner was Aphria Inc (APH.TO), down 4.5 per cent.

Among the most active Canadian stocks by volume were First Quantum (FM.TO), up 3.6 per cent at $18.65; Bombardier (BBDb.TO), up 0.8 per cent at $3.76 and Aurora Cannabis (ACB.TO), down 2.1 per cent at $10.08.

The energy sector gained 3.2 per cent, reflecting a 3 per cent gain in the price of U.S. crude oil.