US Markets

S&P 500, Nasdaq notch another record close after strong earnings from Alphabet, Starbucks

US GDP up 2.1% in second-quarter, down from 3.1% the first-quarter
US GDP up 2.1% in second-quarter, down from 3.1% the first-quarter

Stocks rose on Friday after strong earnings from tech giants like Alphabet and Intel and a better-than-expected GDP print pushed the S&P 500 to a new all-time high.

The S&P 500 gained 0.7% to close at 3,025.86, posting a record high. The Nasdaq Composite also hit an all-time high, rising 1.1% to 8,330.21. The Dow Jones Industrial Average closed 51.47 points higher, or 0.2%, at 27,192.45.

The major indexes briefly pared gains after National Economic Council Director Larry Kudlow told CNBC's "Squawk on the Street" he would not expect a "grand deal" to come out of next week's U.S.-China trade talks.

For the week, the S&P 500 and Nasdaq posted solid gains. The indexes climbed 1.7% and 2.3%, respectively. The Dow advanced 0.1% this week.

Alphabet reported better-than-expected earnings Thursday and announced a massive $25 billion share repurchase program. The results and buyback sent the stock up 9.6%.

Twitter shares gained more than 8% on the back of second-quarter results that topped estimates. The social media company also reported a 14% rise in monetizable daily active users.

Getty Images

Consumer stocks such as Starbucks and McDonald's also contributed to the gains. The coffee company gained 8.9% after reporting hefty same store-sales growth while the burger chain climbed 0.5% as promotions led better-than-expected revenue in the U.S.

More than 40% of S&P 500 companies have reported quarterly earnings for the second quarter. Of those companies, 76.4% have posted a stronger-than-forecast profit, according to FactSet.

The U.S. economy expanded by 2.1% in the second quarter, the Commerce Department said Friday. The broadest measure of the U.S. economy was expected to come in at 1.8%, according to economists surveyed in CNBC/Moody's Analytics Rapid Update.

Growth was driven by a 4.3% increase in consumer expenditures, which offset a 5.5% slump in business investment.

"The consumer and government spending drove all of the gain in GDP as trade, inventories and investment reversed the Q1 gains," Peter Boockvar, chief investment officer at Bleakley Advisory Group, said in a note. "On the question that everyone tries to answer in light of the longest economic expansion on record, when will we see the next recession, I again believe it will be determined by the direction of the stock market."

The data release comes as investors await a potential rate cut from the Federal Reserve next week. Market expectations for a 25 basis-point rate cut were at 78.6% on Friday morning, according to the CME Group's FedWatch tool.

The Fed is scheduled to start its two-day monetary policy meeting on Tuesday. An announcement on rates is set for Wednesday at 2 p.m. ET.

"The market owes its strength in large part to the Fed eases priced in. And the Fed has noted the slowdown in business resulting from the generally slower global economy," said Steve Blitz, chief U.S. economist at TS Lombard. "The net of this is ... the Fed has no option other than to cut 25 on Wednesday and see whether the data unfold to create the need for a further cut in September. The push is to keep equities up and help the world be safe for dollar debt."

—CNBC's Silvia Amaro contributed to this report.