By David Benoit and Joe Wallace

The S&P 500 rose Friday, closing out its biggest weekly advance in three months as investors welcomed signs pointing to a decisive result in next month's U.S. presidential election.

A week that started with President Trump in the hospital being treated for the new coronavirus and Vice President Joe Biden widening his lead in national polls finished as the best stretch for the index since the week of July 2.

The benchmark climbed 30.30 points, or 0.9%, to 3477.13 on Friday, extending its gains for the week to 3.8%. Following a volatile September, October has started with a persistent march higher, with the index up for two consecutive weeks and in six of the past eight trading days. It has risen 7.6% this year.

The Dow Jones Industrial Average rose 161.39 points, or 0.6%, to 28586.90, climbing back into positive territory for the year.

The Nasdaq Composite rose 158.96 points, or 1.4%, to 11579.94. The tech-heavy index climbed 4.6% for the week and is up 29% this year.

With just 25 days before the U.S. election, the race is dominating traders' attention. For months, they have been wagering on extreme volatility around the election through the derivatives, stocks and currency markets, wary that the outcome could remain undecided for weeks.

Some of the uncertainty surrounding the contest appeared to recede this week, and traders began unwinding some of their cautious bets.

"Polling has further consolidated around a Biden advantage in the presidential election...and options markets have significantly reduced the premium they assign to that date," JPMorgan Chase & Co. strategists wrote in a note to clients on Thursday.

Strategists say surveys and talks with investors have recently found a flip-flop on sentiment in the event of a Biden win: Investors previously said it would be bad for stocks, but they now are predicting it would boost markets.

A Democrat "Blue Wave" victory "has curiously flipped from consensus bear catalyst to bull catalyst," Bank of America analysts wrote.

Investors have piled into individual stocks and sectors that would benefit from a Biden presidency. The iShares Global Clean Energy ETF surged to the highest level in 10 years this week as bullish options trading tied to the fund ramped up, too. Mr. Biden has proposed a $2 trillion plan to combat climate change.

Meanwhile, investors spent the week watching for signs fresh stimulus would arrive from Washington, which leaders of both parties say they want and few expect to happen before the election.

The White House is preparing a $1.8 trillion offer, its largest proposal in this round of talks, and White House adviser Larry Kudlow had said Friday on Fox Business that Mr. Trump had approved the plan. That provided a temporary boost to markets in the early afternoon.

"For the market to move higher, we need to see further stimulus in the U.S., to ensure that the recovery that is still ongoing can be at least smoothed over," said Brian O'Reilly, head of market strategy at Mediolanum International Funds.

The pandemic's impact on the economy will get fresh attention next week as the U.S. heads into earnings season. Analysts expect companies in the S&P 500 to report a median 20% drop in per-share earnings, according to FactSet.

But they have actually grown more optimistic in the past three months, increasing the median EPS estimate by 4.1%, according to FactSet's earnings analyst John Butters. That's the first time since 2018 analysts have grown more optimistic during a quarter.

Alexander Altmann, the head of Citigroup's equity trading strategy for the Americas, said those rising expectations might lead to disappointment in the coming weeks because not all trends emerging in the pandemic are actually enduring shifts in consumer habits.

"I wonder whether there's been a bit of a Y2K-effect where people rushed to set up home offices and get their gardening kits," Mr. Altmann said. "A lot of that is not repeatable business. That's where I think there's been a little bit of a risk."

Among individual stocks, chip maker Xilinx led the way in the S&P 500, up $14.95, or 14%, to $120.94 after The Wall Street Journal reported it was in talks to be acquired by Advanced Micro Devices. The deal could be valued at more than $30 billion and mark the latest tie-up in the rapidly consolidating semiconductor industry. AMD fell $3.41, or 3.9%, to $83.10.

In bond markets, the yield on 10-year U.S. Treasury notes ticked up to 0.775% from 0.764% Thursday.

Oil prices edged lower as traders tracked the progress of Hurricane Delta, which has brought offshore production in the Gulf of Mexico to a near standstill.

U.S. crude futures dropped 1.4% to $40.60 a barrel, trimming their gains for the week to 9.6%. The energy sector was the worst performer in the S&P 500, falling 1.6%.

Gunjan Banerji contributed to this article.

Write to David Benoit at david.benoit@wsj.com and Joe Wallace at Joe.Wallace@wsj.com

(END) Dow Jones Newswires

10-09-20 1710ET