The Nasdaq also set an all-time closing high and the blue-chip Dow is now in positive territory year-to-date.

The S&P 500 is close to wrapping up what appears to be its best August in 34 years.

All three major U.S. stock indexes ended the week higher than last Friday's close, marking the fifth consecutive weekly gains for the S&P and the Nasdaq.

"Tech stocks have driven much of the recovery this year, but we are seeing breadth expand, which is helping indices like the Dow Jones Industrial Average," said David Carter, chief investment officer at Lenox Wealth Advisors in New York.

Stocks extended their gains after a top aide to President Donald Trump said the president is willing to sign a $1.3 trillion coronavirus relief bill, four weeks after emergency unemployment benefits expired for millions of Americans.

Economic data released before the bell showed American consumers, who account for about 70% of the U.S. economy, increased their spending more than expected in July but the savings rate, a barometer of consumer uncertainty, remained elevated well above pre-pandemic levels.

The personal consumption expenditures (PCE) core index, which excludes food and energy, rose at a rate of 1.3% year-on-year. On Thursday, U.S. Federal Reserve Chair Jerome Powell unveiled a new monetary strategy adopting an average annual inflation target of 2%, implying the central bank could keep key interest rates near zero even if inflation rises above its target.

"(The Fed's) new-found acceptance of higher inflation suggests the recovery could continue for much longer, as will near-zero rates," Carter added.

The Dow Jones Industrial Average rose 161.6 points, or 0.57%, to 28,653.87, the S&P 500 gained 23.46 points, or 0.67%, to 3,508.01 and the Nasdaq Composite added 70.30 points, or 0.6%, to 11,695.63. Energy stocks ended the session with the largest percentage gain among the major S&P sectors, rising 1.9% after Hurricane Laura passed through the Gulf region without causing widespread damage and oil rigs and refineries began to restart operations.

United Airlines and Coca-Cola Co rose 3.1% and 3.3%, respectively as they prepared for cost-cutting efforts including furloughs and voluntary separations.

But tech companies continue to benefit from companies shifting to a work-from-home model.

Business software company Workday Inc jumped 12.6% after raising its annual subscription forecast and Dell Technologies Inc rose 6.1% following its quarterly profit beat.

Walmart Inc announced it was joining Microsoft Corp in its bid for TikTok's U.S. assets from Chinese owner ByteDance.

Shares of Walmart and Microsoft advanced 2.7% and 1.0%, respectively.

Nutanix Inc soared by 29.2% after the cloud service provider beat earnings expectations and Bain Capital invested about $750 million in the company.

Advancing issues outnumbered declining ones on the NYSE by a 2.47-to-1 ratio; on Nasdaq, a 2.01-to-1 ratio favored advancers.

The S&P 500 posted 28 new 52-week highs and no new lows; the Nasdaq Composite recorded 78 new highs and 17 new lows.

Volume on U.S. exchanges was 8.07 billion shares, compared with the 9.21 billion average over the last 20 trading days.

By Stephen Culp