NEW YORK — J.C. Penney is joining its department store rivals in pruning its store numbers in an era of online shopping.

Penney said Friday that it will close 130 to 140 stores as well as two distribution centers over the next several months as it tries to improve profitability. The company said that it would also initiate a voluntary early retirement program for about 6,000 eligible employees.

The news came as Penney posted a profit for the fourth quarter, compared to a loss a year ago. But total sales were down slightly, and a key revenue metric declined a bit as well. The company issued a conservative annual forecast, sending shares down 9 percent on Friday.

CEO Marvin Ellison acknowledged that Penney wasn't strategic with promotions, which hurt profit margins, and said that its level of couponing was "unhealthy." It plans to use a more data-driven approach to pricing this year after testing the strategy in some categories last year.

Like other department stores, J.C. Penney is trying to adjust to changing shopping patterns. But it is also still recovering from a catastrophic reinvention plan under a former CEO that sent sales and profits freefalling starting in 2012. Since then, it has focused efforts on its home area, started selling major appliances again and expanded its number of in-store Sephora beauty shops.

While its annual sales still shrunk, what's encouraging is Penney's profit picture. Penney was able to pull in a $1 million profit for the full fiscal year, the first time it earned an annual profit since 2010. The stores it is closing represent about 13 percent to 14 percent of its current store count of about 1,000, but less than 5 percent of total annual sales.

"With a slimmed-down store portfolio, (J.C. Penney) will be able to focus on making its remaining stores more of a destination," said Neil Saunders, managing director of GlobalData Retail. "This is essential, as while progress has been made on categories like home, other departments still require attention."

Penney managed to outperform some of its rivals. Kohl's Corp. reported a drop in fiscal fourth-quarter profit as total sales declined. Revenue at stores opened at least a year dropped 2.2 percent. Nordstrom Inc. reported a better-than-expected quarterly profit with help from strong sales online and at Nordstrom Rack. But at the Nordstrom brand, comparable store sales decreased 2.7 percent. Macy's, the nation's largest department store chain, says its earnings for the quarter that includes the holiday period dropped nearly 13 percent, hurt by lower sales, store closures and other costs.

Given the environment, Penney wants to be less dependent on clothing. It's rolled out major appliances in 500 stores and plans to add 100 more appliance showrooms this year. It has updated its beauty salons, now branded Salon by InStyle. It is also beefing up its store label brands like St. John's Bay. In the fourth quarter, top-performing areas included home, Sephora, its salon business and fine jewelry. Last year, it added 61 Sephora stores for a total of 577. This year, it's adding 77 more.

The Plano, Texas-based company has also now armed its store associates with mobile devices to help check out online shoppers who are picking up orders in the store.

Ellison said the company decided that coordinating a voluntary early retirement program with the store closures could lessen the effect on employees. He said the number of full-time workers expected to take advantage of the early retirement incentive will far exceed the number of full-time positions affected by the closures.

Penney also emphasized that its stores can be used as leverage against online retailers, especially for picking up online orders, while many solely online companies are seeing dramatically higher fulfillment costs. Ellison said he was pleased by the double-digit growth of jcpenney.com.

For the fiscal fourth quarter, J.C. Penney reported net income of $192 million, or 61 cents per share. Earnings excluding one-time gains and costs was 64 cents per share. Analysts expected 61 cents per share, according to FactSet.

Revenue totaled $3.96 billion in the period, down 0.9 percent from a year ago. Sales at stores open at least a year, a key gauge of a retailer's health, slipped 0.7 percent. This figure excludes results from stores recently opened or closed.

Penney expects full-year adjusted earnings of 40 cents to 65 cents per share. Analysts expected 54 cents per share, according to FactSet. The company forecast revenue at stores open at least a year to be down 1 percent to up 1 percent this year.

Shares fell 9 percent, or 62 cents, to $6.24 on Friday.

____

Follow Anne D'Innocenzio: http://twitter.com/ADInnocenzio