On Friday, the U.S. stock market closed out its best week this year, helped by surging gains by retailers and technology companies. The S&P 500 index led the pack, climbing almost 3.3 percent, erasing losses from the week before when a broad selloff in commodities dragged the index down.

Stocks climbed higher on the Nasdaq and the Dow Jones Industrial Index during the week, as investors shook off geopolitical concerns stemming from the Paris attacks and a hostage crisis in Mali.

The Dow Jones Industrial Average added 91.06 points, or 0.5 percent, on Friday wiping out its year-to-date losses, led by a 5.46 percent jump in Nike Inc., which announced a $12 billion share buyback, a hike in dividend and a share split Thursday. The sporting goods maker was the top gainer in the consumer discretionary sector.

The consumer discretionary sector, which consists of businesses that sell nonessential goods and services like apparel, automobiles and electronics, was the top gaining sector -- up 1.23 percent -- among S&P’s 10 sectors, as retailers like discount clothing chain Ross Stores Inc. and footwear seller Foot Locker Inc. also reported strong earnings this week.

"Maybe it's just squaring up going into a long holiday week and taking some gains," Chris Gaffney, president, Everbank World Markets told CNBC.

Alphabet Inc., the parent company of Google, led a rally in tech stocks and made its biggest gain in almost a month. The company rose 5.6 percent during the week and closed at $777 on Friday.

Healthcare stocks bounced back on Friday after a selloff Thursday, following a cut in forecast by the largest U.S. medical insurer UnitedHealth Group Inc., which cited losses incurred from its participation in the Affordable Care Act.

Minutes from last month’s U.S. Federal Reserve meeting released on Wednesday also boosted market sentiment as it gave investors more visibility about the planned hike in interest rates in December.

“The market is now focusing on the language around the pace of the [rate] hike. That it’s going to be a gradual and slow hike. Not like the past four or five cycles where the Fed was raising and continued raising,” Anwiti Bahuguna, a senior portfolio manager at Columbia Threadneedle Investments, told the Wall Street Journal.

Many on Wall Street now believe that raising rates next month will be interpreted as a sign of confidence in the U.S. economic recovery, according to a report by Reuters.

“Stocks are rising because investors are taking heart that the Fed believes the economy is on solid footing,” Erik Davidson, chief investment officer at Wells Fargo Private Bank told the Associated Press.