By Caitlin Ostroff and Gunjan Banerji

The S&P 500 advanced Friday and extended its weekly winning streak to three, its longest since October.

Major indexes hovered around the flatline for much of the trading session before racing higher into the closing bell, with the S&P 500 and Dow Jones Industrial Average hitting fresh highs to end the week.

The broad stock market index rose 31.63 points, or 0.8%, to 4128.80, its 20th record for 2021. The benchmark notched gains for a third straight week for the first time in nearly six months. Its weekly gain of 2.7% was its largest since early February.

The Dow gained 297.03 points, or 0.9%, to 33800.60 on Friday, and the Nasdaq Composite added 70.88 points, or 0.5% to 13900.19. The indexes gained 2% and 3.1%, respectively, for the week.

Shares of technology giants were among the biggest winners in the stock market this week as investors returned to a trade that had been wildly popular for much of last year. Bond markets calmed, with yields dropping for four straight days before ticking higher on Friday.

Twitter shares added 12% for the week, while Apple gained 8.1%.

Still, the recent rally has been broad-based as investors have bet that economic growth will pick up as Covid-19 vaccines and government support help revitalize social and business activity.

Last week's jobs report showed that the unemployment rate fell to a pandemic low. Federal Reserve officials reiterated this week that the central bank will continue with policy measures aimed to support the recovery.

The IMF also projected that the world economy will grow 6% this year, the fastest pace of expansion in at least four decades.

Some analysts say they expect the powerful run in the market to continue as more Americans are vaccinated and head out to spend on everything from travel to clothing.

"A lot of people think there's too much optimism, giddiness," said Jim Paulsen, chief investment strategist at the Leuthold Group. "I still think that's going to get even more extreme probably as more people get shots in the arm...However optimistic we feel today, we could feel a heck of a lot more optimistic later this year."

In bond markets, the yield on the 10-year Treasury note recently ticked up to 1.664%, from 1.632% Thursday. It remains below the 1.749% it hit at the end of last month.

Some investors are cautioning that the pace of Covid-19 vaccinations and rising infection levels in some parts of the world may hobble the global recovery. Fed Chairman Jerome Powell on Thursday also said the sluggish pace of the vaccine-rollout outside the U.S. is a key threat to the outlook.

"We're going from this period of time where we're going 'whoa, everything is getting better' and we've forgotten there will be bumps on the road," said Lars Skovgaard Andersen, investment strategist at Danske Bank Wealth Management. "We are in for a time when we have much higher volatility."

Guidance on companies' future profits and sales prospects, which will be forthcoming when the quarterly earnings start next week, are also likely to determine the course of the market in coming weeks.

"We need to now see strong earnings growth to validate this stock rally, " said Anwiti Bahuguna, a portfolio manager at Columbia Threadneedle. "I think it will be validated and we will see stocks higher in the remainder of the year."

Overseas, the pan-continental Stoxx Europe 600 edged up 0.1%.

In Asia, most major benchmarks closed lower. The Shanghai Composite Index shed 0.9%, and Hong Kong's Hang Seng Index declined 1.1%. South Korea's Kospi edged down 0.4%.

Write to Caitlin Ostroff at caitlin.ostroff@wsj.com and Gunjan Banerji at Gunjan.Banerji@wsj.com

(END) Dow Jones Newswires

04-09-21 1713ET