Biggest weekly gain in nearly two years for S&P 500

Alibaba IPO
What a year for IPOs!   

U.S. stocks rose for a third session on Friday, with the S&P 500 tallying its second best week in nearly two years.

"The Fed is going to sit on their collective hands for at least the first half of the year, if not longer. The expectation coming in was what, why and how were they going to raise rates, and nothing was said," said Paul Nolte, senior vice president, portfolio manager at Kingsview Asset Management.

"All in all it's been an exciting week for stocks, and I think the year-end rally is in full force. The Fed has made it quite clear that they are going to be patient, and the market is cheering that," said Peter Cardillo, chief market economist at Rockwell Global Capital, referring to the Federal Reserve's policy statement on Wednesday.

Read MoreKocherlakota: Fed taking 'unacceptable' risks

BlackBerry fell after the wireless-device maker posted a larger-than-expected decline in quarterly revenue; CarMax gained after the used-car seller reported a 16 percent rise in quarter revenue.

"Today's options expirations day, but I don't expect too much volatility because most traders have already closed up positions," said Cardillo, referring to the expiration of stock options, index options, index futures and single-stock futures, an event known as quadruple witching.

The CBOE Volatility Index, one measure of investor uncertainty, fell 1.9 percent to 16.49.

Symbol
Name
Price
 
Change
%Change
DJIA
---
S&P 500
---
NASDAQ
---

After a 95-point jump, the Dow Jones Industrial Average gained 26.65 points, or 0.2 percent, to 17,804.80, leaving it 3 percent ahead of the week-ago finish.

Nike led blue-chip losses after the sporting-goods maker's future orders disappointed.

Rising 3.4 percent for the week, the S&P 500 added 9.42 points, or 0.5 percent, to 2,070.65, with energy rising the most and consumer staples the sole laggard of its 10 major sectors.

The Nasdaq gained 16.98 points, or 0.4 percent, to 4,765.38.

For every stock falling, nearly two gained on the New York Stock Exchange, where nearly 2.5 billion shares exchanged hands. Composite volume approached 6.1 billion.

"Between now and the end of the year, definitely starting Tuesday, trading floors are going to be pretty thin. For investors looking to sell and settle before the end of the year, this week and early next week are the times to do it," Nolte said.

Crude oil for January delivery rallied $2.41, or 4.4 percent, to end the session at $56.52 a barrel, and gold futures for February rose $1.20, or 0.1 percent, to $1,196.00 an ounce on the New York Mercantile Exchange.

"Oil is becoming a political tool, certainly. I will stop short of saying there's a concerted effort, but I think it was constructive that OPEC allowed that to happen," said Nolte of crude's move, with the commodity down nearly 14 percent in December.

Read MoreThe Russian ripple effect

The U.S. dollar gained against the currencies of major U.S. trading partners and the yield on the 10-year Treasury note used to figure mortgage rates and other consumer loans fell 5 basis points to 2.1611 percent.

On Thursday, U.S. stocks rallied, with the Dow industrials climbing more than 400 points for the first time in three years, as investors applauded the Federal Reserve's pledge that it would be patient in increasing interest rates.

Read MoreStocks cheer Fed; best 2 days of 2014 for Dow, S&P