NEW YORK (MarketWatch)—The U.S. stock market ended a turbulent week punctuated with collapse of the ruble, gyrations in the oil prices and the Federal Reserve’s policy meeting, with the biggest weekly gain since October.

Stocks rose for three straight session in the wake of the Federal Reserve’s reassurance that the rate increases would be methodical, while the central bank said it would be “patient” on the timing of the initial hike.

The S&P 500 SPX, -1.15% ended the day up 9.42 points, or 0.5%, at 2,070.65 and gained 3.4% over the past week. Energy and materials sectors were leading the gains on Friday and throughout the week, as investors were betting that the bottom in oil prices might be in sight. Energy sector stocks in particular jumped nearly 10% over the past week, while materials gained 5%.

The moment Yellen unchained stocks from oil

The Dow Jones Industrial Average DJIA, -1.84% gained 26.65 points, or 0.2%, to 17,804.80 and rose 3% over the past week. Chevron Corp CVX, -2.44% and Exxon Mobil Corp XOM, -2.04% advanced the most over the past week, gaining 10% and 8.1% respectively.

The Nasdaq Composite COMP, -0.13% ended the session up 16.98 points, or 0.4%, at 4,765.80. The tech-heavy index gained 2.4% over the past week.

Why the S&P 500 could top 2,200 next year

Joseph Saluzzi, co-founder and co-head of equity trading at Themis Trading, said it’s not surprising to see placid markets in the absence of geopolitical and economic news, though he noted higher than usual volumes.

“The fact that indexes are adding to the gains from the previous days’ rallies is a good sign if you are a bullish investor,” Saluzzi said.

“However, the last selloff happened too close to the previous one in October. Over the past five years, events like that were few in between. If we see another scary event that results in selling in January, we would start worrying as it’s a sign that risks are building up,” he added.

Here are the best S&P 500 stocks and sectors of 2014

Options expiration, more Fed: Peter Cardillo, chief market economist at Rockwell Global Capital, noted that the option-expiration event did not have much impact, probably because traders unwound positions earlier in the weak ahead of the Fed meeting.

“A rise in oil prices was seen as a positive event. We think oil priced found bottom and are likely to rise from here,” he added.

“It’s a neat trick to have rates markets reacting to a ‘more hawkish than expected’ FOMC and the equity market rallying in relief that they were not too hawkish. This tells us about market positioning as much as anything else,” Kit Juckes, Société Générale’s global strategist, said in a note. U.S. Treasurys US:10_YEAR saw the biggest one-day selloff in three months on Thursday.

Can the bull market continue its run in 2015?

Stocks to watch:Aratana Therapeutics Inc. US:PETX shares surged 26% after the pet-medication company said a study showed its canine osteoarthritis pain drug performed significantly better than a placebo.

Shares of Nike Inc. NKE, -1.12% closed down 2.3% after the athletic-gear maker’s results beat forecasts, but orders were viewed as soft.

Red Hat Inc. US:RHT soared 11% after the software company topped Wall Street’s expectations for the third quarter.

Pier 1 Imports Inc. US:PIR jumped 9.2% after the retailer met earnings forecasts and affirmed its full-year outlook.

CarMax Inc. KMX, -1.89% rallied 11% after reporting a better-than-expected fiscal third-quarter profit of $130 million.

For more on notable movers, read our Movers & Shakers column.

Overseas markets:The Nikkei 225 index NIK, +0.17% jumped 2.4%, while the Hong Kong Hang Seng HSI, -2.06% index closed up 1.3%. The Stoxx Europe 600 index SXXP, -3.24% closed 0.4% higher..

Oil futures rallied Friday, shaking off sharp losses earlier in the day and rebounding from their lowest settlement in more than five years. WTI futures for delivery in January CLF25, settled 4.4% higher at $56.62 a barrel. Brent crude for February delivery UK:LCOG5 rose 3.6% to $61.38 a barrel. But the commodity still recorded its fourth straight weekly loss.

The dollar USDJPY, +0.02% continued to gain, rising to ¥119 against the Japanese yen. The dollar traded lower against the ruble RUBUSD, -0.54 for the third straight day, trading at 58.87, compared with 61.07 Thursday, as Russia attempts to stabilize the volatile currency.

Meanwhile, gold prices US:GCG5 edged up on Friday, though lost 2.2% over the week.