NEW YORK (TheStreet) -- Crack open the champagne. The markets have wrapped up for the year.

And what a year it was with benchmark indexes nearly wiping out year-to-date gains before recouping them and then some all within the past two months.

STOCKS TO BUY: TheStreet Quant Ratings has identified a handful of stocks that can potentially TRIPLE in the next 12 months. Learn more.

The S&P 500 closed with double-digit percentage gains, up nearly 12%, while the Dow Jones Industrial Average added more than 8%. The tech-heavy Nasdaq Composite climbed 14%.

"The economy entering the New Year is in better shape than previously thought and is likely to escape a serious downturn in 2015," Peter Cardillo, chief economist at Rockwell Capital, wrote in a research note. "We reiterate our positive outlook for stocks in 2015, as expanding U.S. growth remains favorable for growing corporate earnings."

Oil prices dominated business news headlines over the past several months, playing a key hand in determining the winners and losers for 2014.

Airlines, the beneficiary of plunging gasoline prices, were the best performers of the year, helping to boost the SPDR S&P Transportation ETF  (XTN) more than 34% over 2014. Southwest Airlines  (LUV) was the best performer of the S&P 500, gaining nearly 130%, while Delta Air Lines  (DAL) surged 82%.

Drilling companies fared the worst with the SPDR S&P Oil & Gas Exploration and Production ETF (XOP) down more than 30%. Among the worst performers, Transocean  (RIG) plunged 63%, Diamond Offshore  (DO) dropped 35%, and Noble Corp  (NE) tanked 55%.

Crude oil has suffered gaping losses this year with West Texas Intermediate crude half its mid-summer peak. On Wednesday, the commodity's fall continued, down 0.83% to $53.67 and on track for its biggest annual decline in six years. Oil has been in freefall as supply outpaced global demand and the Organization of the Petroleum Exporting Countries refused to limit future production.

Stock markets didn't close out the year with a bang, though, with all benchmark indexes in the red for the day. The S&P 500 slipped 1%, the Dow was down 0.89% and the Nasdaq Composite fell 0.87%.

Disappointing weekly jobless claims data climbed 17,000 to 298,000 for the week ended Dec. 27. Economists had expected 290,000 new filings for unemployment benefits for the week.

However, on a trend basis, initial claims have improved over the past two weeks, according to RBC Economics economist Josh Nye.

"The current four-week moving average is once again below levels that prevailed throughout the third quarter, thereby providing further evidence of a healthy labor market heading into 2015," he wrote in a report.

Pending home sales increased 0.8% in November, recovering from a 1.1% fall a month earlier. The reading came in better than the 0.5% rise economists had expected.

Meadowbrook Insurance Group (MIG) was one of the best performers of the day, up nearly 19%, after China-based Fosun International said that it will purchase the company for $433 million to strengthen its insurance unit and expand into the United States. The offer represents a 21% premium over Meadowbrooks' Tuesday closing price.

GrubHub (GRUB) was 1.3% higher on an upgrade to "outperform" from Barrington Research. Analyst Jeffrey Houston upgraded the stock on the belief that the Internet service could become an acquisition target to potential suitors Amazon  (AMZN) , Google  (GOOGL) or Priceline (PCLN) .

Digital-media company Perion Network  (PERI) dropped more than 2% after receiving a downgrade to "neutral" from Chardan Capital. Sigma Designs (SIGM) spiked 17% as Needham analysts hiked their price target to $8 and reiterated a "buy" rating.

STOCKS TO BUY: TheStreet Quant Ratings has identified a handful of stocks that can potentially TRIPLE in the next 12 months. Learn more.

-- Written by Keris Alison Lahiff in New York.

More from Markets

How Sports Betting Will Impact TV M&A; Toys 'R' Us Lives On, Somewhere -- ICMYI

How Sports Betting Will Impact TV M&A; Toys 'R' Us Lives On, Somewhere -- ICMYI

Famed Chartist Marc Chaikin Gives Jim Cramer His Top Picks This Wednesday

Famed Chartist Marc Chaikin Gives Jim Cramer His Top Picks This Wednesday

Rewind: Jim Cramer on Trade, Pepsico, SodaStream, Estee Lauder and Nike

Rewind: Jim Cramer on Trade, Pepsico, SodaStream, Estee Lauder and Nike

How Alibaba Earnings and Jerome Powell's Jackson Hole Speech Could Move Markets

How Alibaba Earnings and Jerome Powell's Jackson Hole Speech Could Move Markets

Tesla Gets Major Price Target Slash From JPMorgan After Rough Weekend

Tesla Gets Major Price Target Slash From JPMorgan After Rough Weekend