Stocks rallied from an early decline on Wall Street and finished broadly higher on Friday, recording their largest weekly gain in 16 months.

The S&P 500 gained for the fourth day in a row, adding 1.2% to a run that includes back-to-back days with gains of 2%. The Dow Jones Industrial Average gained 0.8%, while the Nasdaq Composite gained 2%. Each of the three indices had its best week since November 2020.

The market rise this week was fueled by the Federal Reserve, which issued its first interest rate hike since 2018 and signalled several more to come.

Stocks also got a boost as the price of U.S. crude oil, which briefly topped $130 a barrel last week amid concerns that the conflict in Ukraine will squeeze energy markets, eased briefly below $94 a barrel on Wednesday and has since been hovering below $110 a barrel.

The S&P 500 rose 51.45 points to 4,463.12, bringing its weekly gain to 6.2%. The Dow gained 274.l7 points to 34,754.93, and the Nasdaq added 279.06 points to 13,893.84. Smaller company stocks also gained ground. The Russell 2000 index rose 21.12 points, or 1%, to 2,086.14.

The broader market has been volatile over the last few weeks as investors consider a number of concerns including inflation and Russia’s invasion of Ukraine. Major indexes are down for the year in a sharp reversal from solid gains over the last several years.

Oil prices have been extremely volatile and U.S. benchmark crude oil remains above $100. Energy prices were relatively stable on Friday, with U.S. crude oil settling at $104.70 per barrel and Brent crude, the international standard, settling at $107.93 per barrel. Bond yields fell. The yield on the 10-year Treasury slipped to 2.14% from 2.19% late Thursday.

Technology and communication stocks, retailers, automakers and other companies that rely on consumer spending helped lift the market. Chipmaker Nvidia climbed 6.8%, Facebook parent Meta rose 4.2% and Tesla rose 3.9%. Only utility stocks fell.

Several stocks made big moves after releasing their latest financial results and updates. FedEx fell 4% after its fiscal third-quarter earnings fell short of Wall Street forecasts. U.S. Steel slid 4.6% after giving investors a disappointing profit forecast.