US Markets

Stocks end mixed, still post best week of 2016

Where are pump savings going?
Where are pump savings going?
Cashin: Keep your eye on S&P 500 at 1,902
Cashin: Keep your eye on S&P 500 at 1,902
Pisani: Need to see consolidation
Pisani: Need to see consolidation

U.S. stocks closed mixed Friday, mostly shaking off pressure from declines in oil prices to post their best weekly gain of the year so far.
(Tweet This)

"That's encouraging that oil's lower and stocks aren't cratering. That relationship has to be broken down for this to be a sustainable rally," said Dan Veru, chief investment officer at Palisade Capital Management.

The major averages recovered most of their opening losses, with the Nasdaq composite ending up nearly 0.4 percent. The S&P 500 closed flat, while oil fell 3.7 percent.

"I think people feel the market's stabilizing to a certain extent," Peter Coleman, head trader at Convergex, noting the S&P 500 rallied more than 6 percent from its low last week to its recent high this week. After three solid days of gains, Thursday's sell-off was "very mild."

"I'm getting more constructive," he said.

S&P 500 10-day performance

Source: FactSet

January petroleum demand hits 8-year high: API
US Treasurys mixed amid oil dip, CPI data
Yen gains vs euro, dollar as oil, stocks falter anew
Gold retreats after rally but interest rate view supports

WTI futures for March delivery, which expires Monday, settled down $1.13 at $29.64 a barrel but ended the week slightly higher. Oil pared losses after the U.S. oil rig count showed a decline of 26 in the last week, Baker Hughes said.

Futures for April delivery settled down $1.18 at $31.75 a barrel.

"I think when you look at today's market action it's more a story of oil than the Fed and CPI, but the CPI was one element to today's market action because in the back of people's mind the possibility there could be a rate hike down the road (rises) if the economic data continues to trend upward," said Kevin Nicholson, chief risk officer at RiverFront Investment Group. "We need to see oil stabilize above $30."

Read MoreWeek could end well for stocks if oil holds $30

The major U.S. averages ended the week up 2.5 percent or more, with the Dow Jones industrial average and S&P 500 posting their best week since the one ending Nov. 20. The Nasdaq composite outperformed, up nearly 4 percent for the week, its best since the one ending July 17.

"You've had a little bit of an emotional relief that will tend to shore up the market in the short-term," said Bruce McCain, chief investment strategist at Key Private Bank. "You just need a continued flow of ... news that beats expectations, less bad than expected."

In economic news, the consumer price index showed a 0.3 percent rise ex-food and energy in January. The headline figure was unchanged from the previous month. Year-over-year, the core CPI advanced 2.2 percent, the largest rise since June 2012, Reuters said.

Read More 'Bad Goldilocks' emerges as market's worst enemy

"The CPI number doesn't surprise me but it does surprise me the market isn't taking a closer look at it," said David Kelly, chief global strategist at JP Morgan Funds.

"I think it's an important report because it should remind people that underlying inflation pressures are moving up," he said.

U.S. stock index futures indicated a slightly higher open, before erasing gains and holding lower after the data release.

Treasury yields held higher, with the at 0.74 percent and the 10-year yield at 1.75 percent in afternoon trade.

The S&P 500 held mostly lower in afternoon trade after briefly attempting gains. Energy was among the greatest decliners in the index but pared losses in the close to end 0.35 percent lower.

"I think it's technical. The market ran into resistance at 1,950 (on the S&P 500)," said Marc Chaikin, CEO of Chaikin Analytics.

"In a market that's highly volatile and seemingly irrational, the only thing you have to go on are your technicals.," he said, attributing much of the recent gains to short covering.

Read MoreThis is the S&P 500 level everyone's watching

Boeing was the greatest contributor to declines on the Dow Jones industrial average, which closed about 21 points lower after briefly dipping 100 points in morning trade.

JJ Kinahan, chief strategist at TD Ameritrade, said he was surprised by the muted afternoon action since Friday was an options expiration day, which usually sees more volatility.

The Nasdaq composite turned positive in mid-morning trade and closed higher, helped by gains in Applied Materials, Facebook and shares of Alphabet, Google's parent company.

"So far the market's bouncing almost perfectly to work off the oversold conditions we saw last week. There's still a whole lot of overhead resistance," said Adam Sarhan, CEO of Sarhan Capital.

Cleveland Fed President Loretta Mester said Friday that policy will likely need to remain accommodative "for some time" given slow growth abroad, the strong dollar, more restrictive financial conditions and the hard-hit energy sector, Reuters reported. Mester also said Inflation will remain "lower for longer" than previously thought, although the U.S. economy will "work through" market volatility and soft economic data.

Read MoreGlobal interest rates: How does the Fed stack up?

The U.S. dollar index was little changed in late trade, with the euro near $1.113 and the yen at 112.64 yen against the greenback. Sterling strengthened against the dollar.

British Prime Minister David Cameron was negotiating with EU leaders in Brussels about the U.K.'s membership in the union. The talks were continuing after the European market close.

After the U.S. market close, Cameron said he "negotiated a deal to give the U.K. special status in the EU" and he believed it is enough to recommend Britain stay in the union.

Art Hogan, chief market strategist at Wunderlich Securities, earlier said the lack of resolution is "one of the overarching things that doesn't get enough attention" although it's "manifesting itself more in the European market."

European stocks closed lower amid the negotiations and declines in oil. However, the German DAX gained more than 4.5 percent for the week, its best since October.

Asian stocks were mostly lower Friday, but the Nikkei 225 ended the week with gains of nearly 6.8 percent for its best week in more than a year—since October 2014. The Shanghai composite was up about 3.5 percent for the week, its best since mid-December.

Major U.S. Indexes

In earnings news, Deere reported earnings that beat by 10 cents but revenue missed as the strong dollar weighed. The heavy equipment maker said its financial condition is strong, but it expects another "challenging" year ahead.

Nordstrom missed on both the top and bottom line, and gave a below-expectations full-year earnings and sales outlook. The retailer has been negatively impacted by heavy discounting and unseasonably warm weather.

Read More Early movers: DE, VFC, BBY, SBUX, BHI, JWN, & more

The Dow Jones Industrial Average closed down 21.44 points, or 0.13 percent, at 16,391.99, with Intel leading decliners and Home Depot the top advancer.

The Dow gained 2.62 percent for the week, with IBM the top performer and McDonald's and Wal-Mart the only decliners on the week.

The closed down 0.05 points, or 0.00 percent, at 1,917.78, with materials leading six sectors lower and consumer discretionary the top advancer.

The index rose 2.84 percent for the week, with consumer discretionary and information technology leading all 10 sectors higher.

The Nasdaq composite closed up 16.89 points, or 0.38 percent, at 4,504.43.

The Nasdaq advanced 3.85 percent for the week, with Apple gaining 2.2 percent. The iShares Nasdaq Biotechnology ETF (IBB) rose 4.2 percent for the week.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held near 20.5.

Decliners were a touch ahead of advancers on the New York Stock Exchange, with an exchange volume of nearly 1.2 billion and a composite volume of 4.1 billion in the close.

High-frequency trading accounted for 49 percent of February's daily trading volume of about 9.37 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.

Gold futures for April delivery settled $4.50 higher, at $1,230.80 an ounce.

CNBC's Peter Schacknow and Reuters contributed to this report.