The beginning of 2016 marked the worst start to a year in Wall Street history but another week of gains helped to wipe out most of the damage.

Bulls mobilized this week,  thanks to another surge in crude oil and a dovish Federal Reserve, to push markets out of the funk that plagued them in January and February. For the week, the S&P 500 added 1.3%, the Dow Jones Industrial Average climbed2.2%, and the Nasdaq rose 1%. The week's gains were enough to erase year-to-date losses on the S&P 500 and the Dow.

For the year, the S&P 500 has increased 0.35%, while the Dow is up 0.1%. Both benchmark indexes fell into correction territory in mid-January but have since recovered  -- they're down just 4% from their 52-week high.

Much of the week's gains were triggered after the Fed recommitted to a gradual rate-hike timeline, easing investor concerns over the pace of future tightening. The central bank held rates unchanged, a move Chair Janet Yellen described as "prudent" in a press conference following the central bank's two-day meeting.

The Fed now expects two rate hikes this year, down from December's forecast of as many as four. 

"The market started to anticipate this, and so it's just confirmation that the Fed is realizing that the landscape looks a little differently today than it did in December when they started this process of normalizing," said David Jilek, chief investment strategist at Gateway Investment Advisers.

Yellen "seems to be reinforcing the idea that the situation is more fluid," he added. 

Crude oil also dictated market direction for much of the week, closing near its highest level of the year, on higher confidence that major oil-producing countries will agree to a production freeze. Members of the Organization of Petroleum Exporting Countries and non-member Russia will meet in Qatar on April 17 without Iran, which had previously said it wouldn't commit to a freeze because it's trying to boost production to pre-sanction levels.

Closer to home, a weekly read on domestic oil inventories boosted hopes an oversupply crisis is easing, while an increase in active rigs undermined confidence. The Energy Information Administration reported a 1.3-million-barrel increase in inventories over the past week, far below estimates of 2.7 million barrels. On Friday, Baker Hughes reported the number of active U.S. oil rigs rose by 1 to 387 in the past week, the first increase of the year. 

Oil prices, which touched 13-year lows earlier in 2016, are now up 6.2% for the year.

Late-season earnings continued to roll in, particularly from retail companies showing worrying weakness over the holiday quarter. Teen retailer Aeropostale (ARO) plummeted after reporting another quarterly loss, while sales slumped 16%. Guess(GES) - Get Report  tumbled after projecting a sales decline in its first quarter of 0.5% to 1.5%.

Jeweler Tiffany(TIF) - Get Report beat quarterly estimates, though warned of a likely first-quarter disappointment. Housewares retailer Williams-Sonoma(WSM) - Get Report  also issued a disappointing outlook: The chain expects first-quarter earnings of no higher than 52 cents a share, 3 cents short of consensus.

Tech companies reporting this week fared better in their recent quarter. Adobe(ADBE) - Get Report   topped estimates on the back of strong growth in cloud computing services, while Oracle(ORCL) - Get Report reported a better-than-expected performance and boosted its share buyback program by $10 billion.

Deals news was also a headliner. Starwood Hotels (HOT)  agreed to sell itself to Chinese company Angbang for $78 a share on Friday. Marriott(MAR) - Get Report , which had previously made a play for Starwood, has five days to respond.

TransCanada(TRP) - Get Report  agreed to buy Columbia Pipeline Group (CPGX)  for nearly $10 billion. The move boosts TransCanada's presence in the U.S., increasing its total coverage to around 57,000 miles of pipeline in North America.

London Stock Exchange Group (LNSTY) and Deutsche Boerse (DBOEY) finalized an all-share merger agreement which will create Europe's largest securities operator. The new company will be named UK TopCo and will be 54.4% owned by shareholders of the German partner. Deutsche Boerse CEO Carsten Kengeter will lead the $30 billion company.

Fresh Market (TFM)  rocketed higher after Apollo Global Management(APO) - Get Report  agreed to purchase the grocery retailer for $1.36 billion. The offer of $28.50 a share represents a 24% premium to Friday's close. The company previously drew takeover interest from Kroger(KR) - Get Report .

It was a jam-packed week on the economic calendar with critical reports from retail to manufacturing to consumer sentiment. Industrial activity in the U.S. contracted at a faster-than-expected pace in February as utility and mining output slumped. However, manufacturing activity did show a second month of improvement.

"With energy prices beginning to drift higher, the recession in the mining sector may be nearing an end," said Millan Mulraine, deputy chief U.S. macro strategist at TD Securities. "All things considered, the overall outlook for the U.S. industrial sector is beginning to look a little better."

U.S. retail sales in February fell for the second straight month, dragged down by increased discounts at car dealerships and lower gas prices. Meanwhile, the University of Michigan index showed the U.S. consumer less sure of the economy, predicting a rise in gas prices this year and a deterioration of general economic conditions.

The housing market continued to show strength with new construction on single-family homes reaching the highest level since November 2007. Housing starts jumped 5.2% to a rate of 1.18 million in February, while permits rose 3.1% to a rate of 1.7 million.