U.S. stocks on Wednesday climbed for a third session after U.S. industrial production rose more than projected and Yahoo posted better-than-expected earnings, bolstering the technology sector.

Stocks held most of their gains as Federal Reserve Chair Janet Yellen addressed the Economic Club of New York Wednesday afternoon and after the release of the Fed's Beige Book.



"I don't think it's what Yellen is saying; there is general skittishness, one of the more important things really is options expiration has moved up a day, so there's a ton of intraday volatility. Also we have some big earnings tonight and tomorrow," said JJ Kinahan, chief strategist at TD Ameritrade.

Read More Yellen: Fed will keep rates low even when the economy recovers

"It's a big day today, we've got 17 out of the S&P 500 reporting, and so far it's been more good than bad. There is more positive forward guidance than negative, so things will pick up in the second half of the year," said Chris Gaffney, EverBank senior market strategist.

"And, we had industrial production come out on a positive note this morning, supporting the notion that the economy is heating up with the weather," Gaffney said.

Yahoo (NASDAQ:YHOO - News) surged after reporting robust sales at Alibaba Group Holding, the Chinese e-commerce company in which it holds a 24 percent stake. Intel (NASDAQ:INTC - News) gained a day after the chip manufacturer reported a quarterly profit that surpassed Wall Street estimates.

"Earnings aren't as terrible as people thought they were going to be," said Jack Ablin, chief investment officer at BMO Private Bank.

Bank of America (NYSE:BAC - News) fell after posting a first-quarter loss as the lender settled claims tied to mortgage bonds. PNC Financial Services Group (NYSE:PNC - News) rose after the regional bank reported first-quarter profit that beat expectations.

Economic data had U.S. manufacturing output rising for a second straight month in March, with factory production up 0.5 percent last month and overall industrial production climbing 0.7 percent, beating expectations.

Another report from the Commerce Department had the pace of U.S. home construction bouncing back less than expected last month, with the data coming after a report Tuesday that showed homebuilder confidence rising less than projected in April.

The Dow Jones Industrial Average (Dow Jones Global Indexes: .DJI) gained 128.09 points, or 0.8 percent, to 16,390.65, with Visa (NYSE:V - News) pacing gains that had 27 of the index's 30 components rising.

The S&P 500 (INDEX:^GSPC - News) jumped 14.58 points, or 0.8 percent, to 1,857.56, with materials leading gains that extended to all 10 of its major sectors.

The Nasdaq (NASDAQ:^IXIC - News) climbed 40.79 points, or 1 percent, to 4,074.94. The technology-heavy index during Tuesday's session fell to within 0.3 percent from a 10 percent correction from its March 6 high.

For every share on the decline, three rose on on the New York Stock Exchange, where 275 million shares traded by 12:20 p.m. Eastern. Composite volume hit 1.4 billion.

Data from China had the world's second-largest economy expanding by 7.4 percent in the first quarter of 2014, slowing from a 7.7 percent increase in the final quarter of last year.

"I don't think we're going to see a hard landing in China," said Gaffney, who added that the country is taking steps to shore up their economy as it transitions from one driven by exports to one fueled by consumption.

Read More China Q1 GDP growth slows to 7.7 percent.

The dollar fell against the currencies of major US trading partners and the yield on the 10-year Treasury note used in figuring mortgage rates and other consumers loans added 2 points to 2.653 percent.

Crude-oil futures for May delivery rose 56 cents, or 0.5 percent, to $104.31 a barrel; gold futures for June delivery fluctuated, lately up 20 cents at $1,300.50 an ounce. The precious metal fell below its 200-day moving average on Tuesday, its worst session since December.

On Tuesday, stocks turned higher , with the Nasdaq making its largest rebound in five years on upbeat earnings from Dow components Coca-Cola (NYSE:KO - News) and Johnson & Johnson (NYSE:JNJ - News).

Google (NASDAQ:GOOGL - News) and IBM (NYSE:IBM - News) are among the technology companies that report later Wednesday.

