A surprisingly strong report card on the US economy has helped power the benchmark S&P 500 and Nasdaq Composite indexes to record high closes, capping a week of gains for stocks that came largely on the back of resilient corporate profits.

While Intel Corp was the biggest drag on the day after it gave a bleak outlook, Amazon.com’s results provided the biggest boost and Walt Disney also offered support as it basked in strong box office numbers.

After staying close to flat for much of the day on Friday the S&P, Nasdaq and the Dow gained ground in the last hour of trading to register their second record closes for the week. The S&P’s peak for the day was a point below its intraday record.

Rick Meckler, partner at Cherry Lane Investments, a family investment office in New Vernon, New Jersey, said the GDP number was a positive for the market, and investors were satisfied with earnings despite some negative surprises.

“There’s a lot of momentum buying. And with the thought that new highs are likely, there is continued optimism.” said Meckler, adding that the ongoing equity rally has “dragged more believers into it, and it’s sort of self-fulfilling.”

The Dow Jones Industrial Average rose 81.25 points, or 0.31%, to 26,543.33, the S&P 500 gained 13.71 points, or 0.47%, to 2,939.88 and the Nasdaq Composite added 27.72 points, or 0.34%, to 8,146.40.

For the week, the S&P rose 1.2%, while the Dow lost 0.06%, and the Nasdaq gained 1.86%.

After a late 2018 sell-off, stocks have rallied this year in large part due to a more dovish stance from the Federal Reserve as well as hopes of a US-China trade resolution.

Before the market open, US Commerce Department data showed gross domestic product rising faster than expected due to high inventories while consumer and business spending slowed sharply, and homebuilding investment contracted for a fifth straight quarter.

“The economy’s not going off a cliff. Some of the numbers were a little soft but everything that could have gone wrong this week didn’t,” said Brian Battle, director of trading at Performance Trust Capital Partners in Chicago.

“Earnings season has been mixed but it’s been a net positive,” said Battle. “The theatre now pivots from earnings season to the Fed meeting next week.”

The US Federal Reserve meeting is due to start on Tuesday.

The S&P’s biggest boost on Friday was from the consumer discretionary sector, which rose 0.9%.

Its biggest support was from Amazon.com Inc, which rose 2.5% after the e-commerce giant’s quarterly profit doubled and beat Wall Street estimates though its second quarter guidance was lower than expectations.

Also Ford Motor Co surged 10.7% and was the biggest percentage gainer on the S&P after the automaker posted better-than-expected quarterly earnings largely due to strong pickup truck sales in its core US market.

The S&P’s technology index was the biggest drag on the benchmark, with a 0.4% decline.

Intel slumped 8.99% after it cut its full-year revenue forecast and missed the sales estimate for its key data centre business in its quarterly report late Thursday.

Out of the S&P 500’s 11 major sectors, energy was the biggest percentage loser with a 1.2% drop as oil prices sank more than 3 per cent after US President Donald Trump again pressured the Organisation of the Petroleum Exporting Countries to raise crude production to ease gasoline prices.

Also, shares in oil giant Exxon Mobil Corp fell 2% after its quarterly profit missed estimates.

Walt Disney Co rose 1.95% after Marvel Studios superhero spectacle “Avengers: Endgame” hauled in a record $US60 million ($A85 million) at US and Canadian box offices during its Thursday night debut.

Advancing issues outnumbered declining ones on the NYSE by a 2.16-to-1 ratio; on Nasdaq, a 2.11-to-1 ratio favoured advancers.

The S&P 500 posted 39 new 52-week highs and 2 new lows; the Nasdaq Composite recorded 72 new highs and 39 new lows.

Volume on US exchanges was 6.45 billion shares, compared to the 6.64 billion average for the last 20 trading days.