Stocks rose on Tuesday, the first trading day of 2017, but closed off their session highs as oil prices gave back initial gains.
"When oil started to slip and the dollar peaked, that's when you saw stocks fall off a bit," said Robert Pavlik, chief market strategist at Boston Private Wealth. "I think, near term, people are expecting the market to give something back." "The fact remains that the market is not cheap. We're at really high valuations."
The S&P 500 closed about 0.8 percent higher, with telecommunications and health care leading advancers. The Nasdaq composite also advanced around 0.8 percent. The Dow Jones industrial average gained about 120 points, with Walt Disney and Goldman Sachs contributing the most gains.
Crude prices hit 18-month highs amid hopes that a deal struck between OPEC and non-OPEC countries to cut production will reduce excess supply. At session highs, U.S. crude prices had gained more than 2 percent. However, they settled 2.6 percent lower at $52.33 per barrel as concerns that Libya will increase production dampened investor sentiment.
"That's a reminder that there have been questions regarding [production-cut] compliance," said Quincy Krosby, market strategist at Prudential Financial. "Nobody is expecting full compliance. it's a matter of how many countries are out of compliance."
US crude intraday
The three major stock indexes traded around 1 percent higher earlier on Tuesday, with the Dow having risen 175.93 points at session highs. "The real excitement earlier this morning came on the back of global markets rallying and [strong] PMIs," said Art Hogan, chief market strategist at Wunderlich Securities, adding that strong oil prices were also boosting equities.
He also said "you really have to juxtapose the strong gains we've had [in stocks] against the strong dollar. I think that's starting to seep into the market here." The U.S. dollar rose more than 1 percent against a basket of currencies, with the euro trading near $1.04 and the around 117.7.
Chinese stocks closed higher on the back of strong domestic data and of crude's spike, with the Shanghai composite rising 1.04 percent. China's Caixin Manufacturing Purchasing Managers' index (PMI) rose to 51.9, compared with 50.9 in November and beating forecasts for 50.7, on the back of increased demand.
"The first couple of days of the year set the direction for the market. I don't see anything interfering here. I think enthusiasm is still there," said Peter Cardillo, chief market economist at First Standard Financial.
European equities also rose, with the Stoxx 600 Europe index advancing 0.7 percent.
"Traders likely woke up this morning a bit surprised. Most portfolio managers likely surmised that last week's sell-off marked the start of a modest pullback for the broader indices that would dominate the early part of 2017 as institutions normalize their risk and many investors clip profits in an effort to defer capital gains," said Jeremy Klein, chief market strategist at FBN Securities.
In U.S. economic news, the final read on December IHS Markit manufacturing PMI came in at 54.3, hitting a 21-month high. A number above 50 signals expansion, while a number below 50 shows contraction. The ISM manufacturing index read for December, meanwhile, came in at 54.7, above November's read of 53.2. and construction spending hit its highest level in more than 10 years in November.
"We're seeing the exact opposite of what happened last year, in terms of investing and sentiment," said Adam Sarhan, CEO at 50 Park Investments. "The macro picture is improving and the stock market is forecasting better economic data and stronger earnings. That bodes well for Main Street and Wall Street."
U.S. Treasurys fell on Tuesday, with the benchmark 10-year note yields rising to 2.45 percent and the short-term two-year note yield trading at 1.222 percent.
In corporate news, President-elect Donald Trump attacked General Motors in a tweet, claiming the auto giant is making a Chevy Cruze model in Mexico and then sending them to U.S. dealers tax free. GM later responded by saying that most of its Cruze models are in fact built in the U.S.
Ford Motor, which had been bashed by Trump for shipping jobs outside the U.S., announced Tuesday that it will cancel production of a $1.6 billion plant in Mexico, and will instead invest $700 million in Flat Rock, Michigan.
Dow transports, which have been one of the leaders since Trump's win, closed 0.22 percent lower, as shared of Kansas City Southern dropped 4.75 percent. Kansas City Southern is heavily dependent on shipping along the U.S.-Mexico border.
The gained 19 points, or 0.85 percent, to end at 2,257.83, with telecommunications leading 10 sectors higher and utilities lagging.
The Nasdaq composite advanced 45 points, or 0.37 percent, to close at 5,429.08.
About three stocks advanced for every decliner at the New York Stock Exchange, with an exchange volume of 972.23 million and a composite volume of 3.684 billion at the close.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, fell 7.8 percent, to about 12.9.
Gold futures for February delivery gained $10.30 to settle at $1,162 per ounce.
— CNBC's Aza Wee Sile and Berkeley Lovelace Jr. contributed to this report.
On tap this week:
Monthly vehicle sales
2 p.m. FOMC minutes
8:15 a.m. ADP employment
8:30 a.m. Initial claims
9:45 a.m. Services PMI
10 a.m. ISM nonmanufacturing
8:30 a.m. Employment
8:30 a.m. International trade
10 a.m. Factory orders
11:15 a.m. Chicago Fed President Charles Evans
1:00 p.m. Richmond Fed President Jeffrey Lacker
3:30 p.m. Dallas Fed President Robert Kaplan
11:15 a.m. Federal Reserve Governor Jerome Powell at AEA annual meeting
11:15 a.m. Minneapolis Fed President Neel Kashkari at AEA