Wall Street gains on economic optimism

U.S. stocks rallied across the board as a solid earnings season and upbeat economic data fueled optimism about the economy's recovery.

The Dow gained 153 points. The S&P 500 rose 18. The Nasdaq jumped 15.

After the closing bell, Amazon posted second-quarter sales of $113 billion compared to the $115 billion predicted by analysts, a rare sales miss. And its third-quarter sales outlook came in in way below forecasts. Amazon is seeing increased competition from Walmart and Target. Profits, however, beat expectations.

One of the most highly anticipated market debuts of the year turned out to be a dud. Shares of Robinhood fell in their market debut, tumbling more than 8 percent on concerns about the controversial trading app's business model.

On the economic front: the U.S. economy grew at a 6-1/2 percent annualized rate in the March to June period. Second-quarter gross domestic product, or GDP, did come in lighter than expected due to supply disruptions.

But David Dietze, senior portfolio strategist at Peapack Private Wealth Management, said there was still much to like about this number.

"Here's what I liked about it, first of all, is you look at that consumer expenditure metric that was actually up close to 12, higher than had been expected. And remember the consumer, 70 percent of the U.S. economy. So the consumer is out there alive and kicking well, and spending."

Investors also say the number wasn't hot enough to change the view that the Fed is on hold from withdrawing its extraordinary assistance to the economy.

In other economic data: new claims for unemployment benefits came down last week to 400,000.

And pending home sales, which measure signed contracts for home purchases, dipped in June - led by big declines in the South and the West.