US Markets

Stocks close up on oil; S&P at record, Dow above 18,000

Pro: S&P at 2000 or below
VIDEO3:2803:28
Pro: S&P at 2000 or below

U.S. stocks closed at highs on Friday, with the Dow above 18,000 and S&P 500 setting a new record as firming oil prices sent the energy sector higher.

Stocks "typically rally into idea that oil might be bottoming," said Art Hogan, chief market strategist at Wunderlich Securities.

He added that with Russia's peace deal with Ukraine and encouraging headlines out of Greece's negotiation with the euro zone, "the tone of investors is more constructive going into next week."

The Dow Jones industrial average closed up 46.97 points, or 0.26 percent, to 18,019.35, with Caterpillar leading 16 blue chip advancers and American Express the greatest laggard. The last time the index closed above 18,000 was on Dec. 26, 2014.

The closed up 8.51 points, or 0.41 percent, at 2,096.99, with the energy sector up 1.95 percent to lead six sectors higher and utilities the greatest decliner.

The Nasdaq closed up 36.22 points, or 0.75 percent, to 4,893.84, its highest level since March 2000, the peak of the dotcom bubble. The Russell 2000 also closed at a record high.

"Oil is up again. The market is fairly pricing in that we could bottom around $45 to $55 (a barrel)," said Peter Cardillo, chief market economist at Rockwell Global Capital. "That probably is going to be healthy for the market in general."

Crude oil futures settled up $1.57, or 3.10 percent, at $52.78 a barrel on Friday, while brent oil traded above $61 a barrel, the first three consecutive weeks of gains since last spring.

Regressive analysis by Wunderlich Securities found that since crude began its plunge last year, the S&P 500 has had a 0.70 correlation with crude, up from the low 0.03 correlation the two had for the last 25 years.

In other energy news, the number of oil rigs in the United States fell to the lowest level since August 2011.

Read MoreHow $30 oil could be worse than you think: CEO

Greek Prime Minister Alexis Tsipras agreed to meet with representatives from the European Union, the European Central Bank and the International Monetary Fund, ahead of Monday's key Eurogroup meeting on debt talks, according to Reuters.

Meanwhile, the European Central Bank allowed Greek banks to access extra emergency financing from the Bank of Greece because deposit outflows have increased and to ensure they have liquidity while discussions continue in Brussels next week, Greek banking sources told Reuters on Friday.

On Sunday, Russia is expected to enter a cease-fire with Ukraine as announced early on Thursday.

Most analysts expect the encouraging geopolitical developments and next week's shortened trading week packed with economic data to send markets higher.

Cardillo said the S&P 500 could rise as high as 2,125 before pulling back.

Hogan cautioned that as stocks continue to gain, "markets tend to run into some resistance as we head up into a new high level."

Stocks pared gains slightly after consumer sentiment dropped 4.6 percent in February, missing expectations.

"The consumer confidence number was weaker than expected," said Peter Boockvar, chief market analyst at The Lindsey Group. He said there was no definite reason for Friday's rally, and noted that with the week's strong performance, it would not be surprising "to take a little breather here."

U.S. import prices fell 2.8 percent last month, their biggest drop in six years as the cost of petroleum and a range of other goods fell, a sign that domestic inflation pressures could remain muted for a while. It was the seventh straight month of declines in import prices.

European stocks closed higher, following forecast-beating growth data from the euro zone and a firming oil price.

The euro zone's gross domestic product expanded more than expected in the fourth quarter of 2014, boosted by an acceleration in Germany's growth. The region's GDP expanded by 0.3 percent in the final three months of the year from the previous quarter—above analyst expectations.

Read MoreEuro zone growth beats as Germany storms ahead

J.M. Smucker posted a 3.5 percent fall in quarterly profit as demand for its coffee products declined after price increases in the United States.

Zynga broke even on an adjusted basis for its latest quarter, matching expectations, but investors are focusing on disappointing over lower than expected bookings. The creator of "Farmville" did not see as much engagement as it had thought for new offerings like "New Words With Friends", and it's forecasting an unexpected loss for the current quarter.

Major U.S. Indexes


ConAgra Foods cut its full-year profit forecast due to weaker sales and a stronger dollar. The company also named Sean Connolly as its chief executive officer, replacing the retiring Gary Rodkin. Connolly was CEO of Hillshire Brands prior to its sale to Tyson Foods last year.

Read MoreEarly movers: GPS, ANF, VFC, DTE, CAG & more

Nike's Chief Financial Officer Donald Blair is retiring in October, to be replaced by senior vice president of finance Andrew Campion.

Advancers were a step ahead of decliners on the New York Stock Exchange, with an exchange volume of 759.9 million and a composite volume of 3.5 billion in the close.

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

High-frequency trading accounted for 47.5 percent of February daily trade volume of about 7.3 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.

The U.S. 10-year Treasury yield traded above 2 percent. The U.S. dollar edged lower against major world currencies. The Dow Utility Average dipped into correction territory before bouncing back.

Gold futures settled up $6.40 to $1,227.10 an ounce on the New York Mercantile Exchange.

—Reuters, CNBC's Peter Schacknow and Jenny Cosgrave contributed to this report.