U.S. equities closed mostly higher on Friday, with the three major indexes posting their best weekly gains of the year on the back of a surprise Republican sweep.

"I think you're seeing a transition from a government that had its thumb on growth to a free economy," said Bruce Bittles, chief investment strategist at Baird. "We're now looking at an economy that can reach its full potential."

The Dow Jones industrial average closed about 37 points higher, with Goldman Sachs contributing the most gains. For the week, the Dow rose around 5.4 percent, marking its best weekly performance since December 2011.

"The Republican sweep across Washington should pave the way for tax reform at both the individual and corporate level. America's largest multinational companies will almost assuredly have the opportunity to repatriate some of its foreign cash holdings for a modest penalty," said Jeremy Klein, chief market strategist at FBN Securities.



The S&P 500 underperformed, falling 0.15 percent, with energy falling 1.68 percent to lead decliners. The index, however, ended the week about 3.8 percent higher, posting its highest weekly gain since 2013.



Energy stocks were pressured by falling oil prices, as U.S. crude fell 2.8 percent to settle at $43.41 per barrel after OPEC said October output reached another record, casting doubt on whether its plan to limit production is achievable or enough to ease persisting oversupply in the market.

The Nasdaq composite rose more than half a percent and gained 3.8 percent for the week, marking its best weekly performance since February.

"Within a week, the market went from egregiously oversold to overbought. They managed to repair all the damage done during the nine-day losing streak," said Adam Sarhan, CEO of 50 Park Investments.

Stocks skyrocketed after Republican Donald Trump's surprise victory over Hillary Clinton, as investors considered the prospects of higher infrastructure spending and less regulation within the financial sector. The Dow closed at an all-time high on Thursday, while the S&P and the Nasdaq were flirting with their record highs entering Friday. Financial markets, as well as numerous pollsters and political analysts, had expected Clinton, the former secretary of State, to win the race for the White House.

"The market is giving Trump the bullish benefit of the doubt," Sarhan said. But "if he starts going off the deep end, whether on foreign policy or something else, then that could be bad for the market."