Energy shares drove U.S. stocks higher on Friday as an upbeat outlook from Chevron Corp gave a boost to the sector and U.S. wholesale inventories data supported bets on an improving economy.

The S&P energy sector <.GSPE>, up 1 percent, led the market's advance, with Chevron up 2 percent at $79.21 a day after it said its refining and marketing arm would return to profit in the first quarter, while earnings from oil and gas production would grow.

ConocoPhillips and Exxon Mobil Corp both rose more than 1.4 percent.

Data showed U.S. wholesale inventories rose more than expected in February and sales at wholesalers reached their highest level in 16 months, brightening prospects for first-quarter economic and earnings growth.

Seems like energy shares are catching up with oil's (recent) rise above $85 per barrel. News on Chevron having a positive outlook is lending some support, said Alan Gayle, senior investment strategist at RidgeWorth Investments in Richmond, Virginia.

The inventory data suggests businesses are still in the process of normalizing output levels, which could set the stage for some reasonable earnings, he said.

The Dow Jones industrial average <.DJI> gained 31.97 points, or 0.29 percent, to 10,959.04. The Standard & Poor's 500 Index <.SPX> added 3.52 points, or 0.30 percent, to 1,189.96. The Nasdaq Composite Index <.IXIC> rose 8.58 points, or 0.35 percent, to 2,445.39.

The three major U.S. stock indexes were on track for a sixth straight week of gains -- a positive run not seen since stocks rebounded from more than 12-year lows in March 2009.

Also boosting the energy sector, Atlas Energy shares jumped nearly 17 percent to $37.09 after Indian energy company Reliance Industries agreed to pay $1.7 billion for a stake in an Atlas' shale project to provide natural gas.

Shares of J.C. Penney Co Inc , the big U.S. department store operator, rose 1.7 percent to $31.50 after Goldman Sachs added the stock to a list of recommended buys.

Palm Inc
shares surged 11 percent to $5.16, capping a volatile week in which the smart phone maker's stock has seesawed on options market chatter and takeover rumors.

Worries about Greece's debt problems, which have weighed on stocks for weeks, eased after a European Union source said policymakers had reached an agreement on terms of possible emergency loans for Athens. The U.S. dollar index <.DXY> slipped 0.6 percent, while the euro rose nearly 1 percent. Earlier, stocks pared gains on news that Fitch downgraded Greece's debt rating.

(Reporting by Rodrigo Campos; Editing by Kenneth Barry)