U.S. stocks closed up about 1 percent on Thursday,encouraged by stabilization in oil and shaking off concerns about Greece ahead of tomorrow's all-important jobs report.
"The bullish factor is that oil prices have stabilized," said Bruce Bittles, chief investment strategist at R.W. Baird. "Now that oil prices have stabilized (investors) are changing attitudes towards the global economy."
The major indices recovered losses for 2015, with the Nasdaq gaining 0.61 percent for the year. The Dow Jones Industrial Average gained 0.35 for the year and the S&P 500 rose 0.18 percent for the year.
Oil recovered to settle above $50 a barrel with gains of nearly 4 percent after closing almost 9 percent lower on Wednesday. Movements in the commodity have stayed within a $45 to $55 range this week.
"We have a habit of looking at crude as a barometer for global economic growth," said Art Hogan, chief market strategist at Wunderlich Securities. Regressive analysis by his firm showed that for the last 25 years the S&P 500 has only had a 0.03 correlation with crude. That correlation has jumped to 0.7 since crude began its plunge last June.
Among other morning reports, weekly jobless claims came in at 278,000, below estimates of 290,000 and above last week's 267,000 figure. Non-farm productivity fell a greater-than-expected 1.8 percent for the fourth quarter. Economists had forecast productivity, which measures hourly output per worker, rising at a 0.5 percent pace.
"Although none of this (data) is on the A-list, it's not bad," Hogan said. He added that oil's gains, reduction of concerns over Greece and positive corporate news also boosted markets.
Friday morning's non-farm payrolls report will show important data on growth in wages and employment. Analysts are expecting creation of 230,000 jobs.
The Dow Jones Industrial Average gained 200 points in the minutes before the close, led by Pfizer, whose shares spiked more than 3 percent on news of its acquisition of Hospira for about $15 billion to gain access to biosimilars, copies of biotech drugs made from living cells.
Also leading blue chip gains was DuPont, whose shares rose after being halted on news that the firm named Edward Breen and James Gallogly to its board. Trian, which nominated its own slate for the board, said it refused to consider any proposal that didn't include Nelson Peltz.
The majority of S&P 500 companies that reported earnings early on Thursday beat expectations by 1 percent or more, according to The Earnings Scout.
Overseas, continued talks between Greek and euro zone leaders show that the developments are part of a negotiation, making the situation "less of a negative" for now, Hogan said, noting that investors will still be watching headlines closely for signs of risk.
The European Central Bank's announcement late on Wednesday that revoked a waiver allowing banks to use Greek government debt as collateral for loans rattled stocks slightly before the close. The Dow Jones Industrial Average still eked out a positive gain of about 6 points, buoyed by Disney's nearly 8 percent gain.
"U.S. industrials should know that Greece should not have an impact on global markets and are trying to look past it," said Peter Boockvar, chief market analyst at The Lindsey Group.
"We'll probably see the market trade on the positive side for most of the day," said Peter Cardillo, chief market economist at Rockwell Global Capital. An S&P 500 close above 2,050 "would indicate the rally could take us up to new record highs before the end of the month."
Other analysts indicated 2,060 as the next key resistance level. The S&P 500 closed at a record high of 2,090.57 on Dec. 29, 2014.
The closed up 21 points, or 1.03 percent, to 2,062.52, with materials leading gains across all sectors.
Ball Corp led gains with a 9 percent rise following the company's statement relating to the possible acquisition of its UK rival Rexam. Ball is a supplier of metal packaging to the beverage, food, personal care and household products industry.
Futures held gains after digesting U.S. economic data before the bell.
The U.S. trade deficit for December widened sharply to its highest level since 2012. The Commerce Department said on Thursday the trade deficit jumped 17.1 percent to $46.6 billion, the largest since November 2012. It was the biggest percentage increase since July 2009.
The number of planned layoffs by U.S. employers rose to a nearly two-year high in January as the energy industry slashed jobs in the face of falling oil prices, according to a report by Challenger, Gray & Christmas.
"The big reports are obviously tomorrow," said Randy Frederick, managing director of trading and derivatives at Charles Schwab. "Wouldn't be surprised if we had another day like yesterday, a fairly quiet day. Yesterday had the lowest single-day volume that we've seen in a while."
In corporate news, social media giant Twitter reports after the bell, as does video game maker Activision Blizzard.
Also reporting earnings after the bell, CME Group will be in focus after the group announced plans to close most of its futures trading pits in Chicago and New York City by July 2 on Wednesday.
The Dow Jones Industrial Average closed up 211 points, or 1.20 percent, at 17,884.8, with DuPont and Pfizer leading gains as all blue chips advanced.
The Nasdaq closed up 48.39 points, or 1.03 percent, to 4,765.10.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded near 17.
High-frequency trading accounted for 47.5 percent of February to date's daily trading volume of about 8 billion shares, according to TABB Group. During the peak levels of high-frequency trading in 2009, about 61 percent of 9.8 billion of average daily shares traded were executed by high-frequency traders.
Three stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 793.7 million and a composite volume of about 3.7 billion in the close.
The U.S. 10-year Treasury yield traded near 1.81 percent. The U.S. dollar edged lower against major world currencies.
Crude oil futures settled up $2.03 at $50.48 a barrel on the New York Mercantile Exchange. Gold futures closed down $1.80, or 0.14 percent, at $1,262.70 an ounce.
On tap this week:
Earnings: Activision Blizzard, CME Group, Expedia, GoPro, LinkedIn, McKesson, News Corp., Nuance Communications, Symantec, Twitter, Buffalo Wild Wings, Lionsgate, Pandora, Tempur Sealy, Yelp
4:30 p.m.: Fed balance sheet/Money supply
8:30 a.m.: Nonfarm payrolls
12:45 p.m.: Fed's Lockhart speaks
3:00 p.m.: Consumer Credit
More From CNBC.com: