* Fed raises rates as expected
* Facebook gains after two days of steep losses
* Energy stocks jump as oil prices rise more than 2 pct
* Dow up 0.59 pct, S&P 500 up 0.38 pct, Nasdaq up 0.18 pct (Updates to mid-afternoon, changes byline)
By Chuck Mikolajczak
NEW YORK, March 21 (Reuters) - U.S. stocks rose on Wednesday, building on earlier gains after the U.S. Federal Reserve raised interest rates as expected and a recovery on Facebook shares.
The Federal Reserve 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 investors will turn to a press conference from new Fed Chairman Jerome Powell for signals on the number of hikes planned for the year.
"Everybody expected the rate increase but there was some question if it would go to three rates to four, it stayed flat at three raises for now," said Thomas Martin, senior portfolio manager at Globalt Investments in Atlanta.
"The reason was the Fed statement that economic activity has been moderating since the last time they talked about it." The reason was the Fed statement that economic activity has been moderating since the last time they talked about it.
Financials, which benefit from a higher rate environment, extended gains in the wake of the announcement and were last up 1.04 percent.
Facebook shares gained 1.34 percent and provided some relief to the technology sector. In a sharp sell-off over two days, the social media company lost about $50 billion in market value over reports of data misuse that raised broader questions about consumer privacy and the need for tougher regulation.
The technology index was up 0.09 percent.
Energy jumped 2.77 percent 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.
While markets are sure about the quarter-point rate hike, they are less confident of what the Fed signals next: three increases this year, as previously forecast by policy makers, or four.
The Dow Jones Industrial Average rose 147.03 points, or 0.59 percent, to 24,874.3, the S&P 500 gained 10.31 points, or 0.38 percent, to 2,727.25 and the Nasdaq Composite added 13.36 points, or 0.18 percent, to 7,377.66.
General Mills slumped 9.52 percent 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.91 percent, JM Smucker down 4.11 percent and ConAgra off 3.10 percent.
Southwest Airlines fell 4.98 percent after the carrier cut its forecast for a key revenue metric. Other airlines also fell, with the NYSE Arca Airline index down 0.94 percent.
Advancing issues outnumbered declining ones on the NYSE by a 1.69-to-1 ratio; on Nasdaq, a 2.03-to-1 ratio favored advancers. (Reporting by Chuck Mikolajczak Editing by Nick Zieminski)