NEW YORK ( TheStreet) -- Stocks soared Thursday as optimism about China's economic growth and stimulus-friendly commentary from Federal Reserve officials revived the risk-on trade.

The main driver for the buying was rampant speculation that China's upcoming gross domestic product report will surprise to the upside. There was also a good bit of bullishness surrounding Google's ( GOOG) report, sending the stock up 2% in the regular session.

The Internet search giant lived up to the hype, beating the consensus profit view handily and announcing plans for a new class of non-voting shares that would essentially amount to a two-for-one stock split. The stock rose less 1% in the extended session.

The Dow Jones Industrial Average leapt 181 points, or 1.4%, to close at 12,987. The S&P 500 was up 19 points, or 1.4%, to finish at 1388 as all ten large-cap sector components rose, led by gains in materials. The Nasdaq rose 39 points, or 1.3%, to settle at 3056.

China will release data for first-quarter gross domestic product Friday. Economists polled by Dow Jones Newswires estimate that the nation's economy expanded 8.3% during the period, after growing 8.9% during the fourth quarter. There were rumors among traders that China's first-quarter GDP growth could come in at 9%.

In Asia, Japan's Nikkei Average rose 0.7% and Hong Kong's Hang Seng index settled higher by 0.9%, snapping a three-day losing streak. London's FTSE closed up 1.3% and Germany's DAX rose over 1% amid easing yields for Spanish and Italian bonds.

Also, New York Fed president William Dudley hinted Thursday at more opportunities for stimulus, if warranted by signs of any economic deterioration. That followed comments from Federal Reserve Vice Chairman Janet Yellen, the right hand of Chairman Ben Bernanke, on Wednesday voicing her continued support for an extended period of low interest rates.

The highly influential Dudley, in prepared remarks for a speech in Syracuse, NY, said "it is still too soon to conclude that we are out of the woods, as underlined by the March labor market release;" and alluded to 2010 and 2011, when economic data looked brighter at this point in time, only to fade later in those years.

Twenty-six of the Dow's 30 components closed in positive territory. Hewlett-Packard ( HPQ) was the biggest gainer, rising more than 7% after Gartner reported a 1.9% year-over-year increase in worldwide PC shipments for the first quarter. HP increased its dominance, grabbing a 17.2% share of shipments.

Other blue chips gaining more than 2% included Alcoa ( AA) , Bank of America ( BAC), Boeing ( BA), Caterpillar ( CAT) , Intel ( INTC), and Microsoft ( MSFT).

Gainers far outpaced decliners in the broad market, 5 to 1 on the New York Stock Exchange and 3 to 1 on the Nasdaq.

If you liked this article you might like

Feeling a Little Delphic on the Direction of Alcoa

How to Profit With Technical Analysis: Cramer's 'Mad Money' Recap (Fri 8/25/17)

Cramer: This Rally Isn't Without Meaning

Cramer: The Market Feels More Treacherous Than It Looks

Alcoa Still Unable to Hit New Highs on the First Try