Stocks inched closer to record levels on Friday, boosted by robust earnings from Google-owner Alphabet and Intel, and data that showed the domestic economy slowed lesser than expected in the second quarter.

The Commerce Department said GDP increased at a 2.1 percent annualized rate in the second quarter, higher than a 1.8 percent rate economists had forecast.

Hopes that the Federal Reserve will cut rates by at least 25 basis points at its policy meeting at the end of this month have powered a solid run in stocks this month, helping Wall Street scale record levels.

The S&P 500 and Nasdaq indexes are now within striking distance of another all time high.

"This is just what the market needed, not so soft that the economy is slowing down precipitously and not so strong that the Fed is going to reverse course," said Art Hogan, chief market strategist at National Securities in New York.

"We expected bad earnings and bad GDP numbers, but an upside on both is something markets are going to embrace today."

Alphabet jumped 11.3 percent, the most on the S&P 500 index, after its quarterly results beat estimates, easing investor concerns about growth challenges faced by its Google advertising business.

Twitter jumped 8.3 percent after it posted better-than-expected second-quarter revenue and an uptick in daily users who see advertisements on the site.

In mid-morning trading, the Dow Jones Industrial Average was at 27,174. The S&P 500 was trading at around 3,017, and the Nasdaq Composite hit 8,316.

Two weeks into the second-quarter earnings season, about 75 percent of the 185 S&P 500 companies that have reported so far have topped profit estimates, according to Refinitiv data.

One decliner was Amazon, which fell 2.3 percent after the online retailer reported its first profit miss in two years and said income would slump in the current quarter.