By Alexandra Scaggs 

U.S. stocks gained broadly on Wednesday, as rising hopes of economic stimulus from Asia helped boost investor confidence.

The Dow Jones Industrial Average rose 99 points, or 0.6%, to 16362. The S&P 500 index advanced 10 points, or 0.5%, to 1853, with all 10 sectors higher.

The Nasdaq Composite Index climbed 23 points, or 0.6%, to 4057, with its rise bolstered by gains in social-media and biotechnology stocks. The Nasdaq Biotechnology Index rose 1.3%.

On Tuesday, stocks ended a roller-coaster session broadly higher. The Dow closed up 89 points to post the best two-day point gain since March 18.

Helping drive the gains was a report showing that China's gross domestic product grew 7.4% in the first quarter, the slowest rate in 18 months, but above economists' forecasts of 7.3%. Traders said the slowing pace of growth raised some hopes of more stimulus from the Chinese government.

"The Chinese data certainly corroborates the idea that the economy is slowing, but at the same time officials have become concerned enough" that more stimulus could be a possibility, said Dan Greenhaus, chief market strategist at New York brokerage firm BTIG.

And that is a positive factor for stocks globally, he said. Stocks in Europe and Asia gained, with the Stoxx Europe 600 up 1.3%. Japan's Nikkei Stock Average shot up 3% after Bank of Japan Governor Haruhiko Kuroda said he would closely monitor stock prices and that inflation was on a steady track toward a 2.0% target. China's Shanghai Composite gained 0.2%.

But U.S. traders said that the day's action didn't indicate a broad rush into stocks. They said they didn't see many bets on broad stock indexes--instead, investors were doing more trading in shares of individual companies reporting earnings this week.

Trading has been "listless" this week, said Joseph Greco, managing director of trading with New York brokerage Meridian Equity Partners. "There was no conviction."

And the China news "started the motion," he said, so "that is the direction [the market] is going to head."

That momentum helped offset mixed earnings reports. With 47 companies reporting, the S&P 500 is on pace to report that first-quarter earnings declined 1.9% from the previous year, according to FactSet, and that sales rose 2.2%.

U.S. stock-market gains this year will be mostly based on earnings, said Christian Ledoux, director of equity research at South Texas Money Management. "It is going to be bumpy for most of the year... equity [valuations] are slightly above average, and they're working their way toward overvalued."

Still, he said he is keeping his allocation to stocks steady, since they are a good value when compared with investments such as bonds.

Dow component Intel shares rose 0.2% after it reported late Tuesday first-quarter earnings that topped analyst estimates, while revenue was in line with its forecast and PC sales continued to decline.

Yahoo surged 5.6% after first-quarter results exceeded expectations, and the company provided an upbeat revenue outlook for the current quarter.

Bank of America slipped 2.3% after the banking giant reported it swung to a first-quarter loss as a result of previously-disclosed litigation expenses, while revenue fell slightly less than expected.

Stocks held their broad gains as Federal Reserve Chairwoman Janet Yellen spoke about monetary policy and the economy at the Economic Club of New York. The Fed's "beige book" report, a read on the U.S. economy from anecdotes gathered by the central bank's 12 districts, is due later in the afternoon.

In other economic news, new residential construction for March rose 2.8% to a seasonally adjusted annualized rate of 946,000, falling well below forecasts of a rise of 6.4% to a seasonally adjusted annualized rate of 965,000. Building permits fell 2.4% to 990,000, versus forecasts of 1.01 million.

Industrial production rose 0.7% in March, while a rise of 0.4% was forecast. Capacity utilization rose by more than expected as well.

The yield on the 10-year Treasury note rose to 2.637% from 2.628% late Tuesday. Gold futures gained 0.2% to $1,302.70 a troy ounce, after falling 2% Tuesday to mark the biggest one-day percentage loss since Dec. 19. Crude-oil futures slipped 0.3% to $103.48 a barrel. The dollar rose against the yen, but lost some ground against the euro.

In corporate news, New York investment bank Moelis & Co. rose 5.4% in its public debut, after pricing its initial public offering below its forecast range.

Google, which is due to report results after the close, rose 2.5%.

Twitter slipped 2.4%. The stock shot up 11% Tuesday, the biggest one-day gain since the microblogging site went public in November. Tuesday's rally came one day after some of the company's earliest and biggest backers said they didn't plan to sell shares when rules barring them from doing so expire next month.

Twitter had been one of the hardest-hit of the previous highfliers, as the stock was down 37% on the year through Friday, after ending last year 145% above its $26 initial public offering price.

Write to Alexandra Scaggs at alexandra.scaggs@wsj.com