J.C. Penney Co. (NYSE:JCP) has announced that it would be closing as many as 140 of its roughly 1,000 stores by June. The stores it is closing represent about 13 percent to 14 percent of its current store count, but less than 5 percent of total annual sales. The company is also planning to close two distribution centers. Chief Executive Marvin Ellison said the closings will also allow J.C. Penney to adjust its business to “effectively compete against the growing threat of online retailers.”

Many American retailers are choosing to shrink to survive the shift away from traditional stores. Those retailers have been steadily losing business to online rivals like Amazon.com Inc. and off-price retailers like TJX Cos. According to Commerce Department figures, spending rose 11 percent at online retailers during the year while falling almost 6 percent at department stores.

Hundreds of department stores are likely to close in the coming months after a lackluster holiday season, especially in weaker and older malls. Macy’s Inc. has already announced plans to close 100 locations, while Sears Holdings Corp. is closing 108 Kmart and 42 Sears stores. Rival Kohl’s said they had no plans for mass closings at the 1,150-store chain.

The 114-year-old J.C. Penney chain had avoided mass closings despite years of losses. Company executives said they were closing the weaker stores to revamp those in stronger markets. The company said it would identify the locations that are set to close next month. Many of the closures are expected to be smaller stores in rural locations.

Mr. Ellison said the remaining store base gives J.C. Penney numerous locations that can be used to ship or pick up online orders, reducing delivery costs. Roughly 77 percent of Penney’s online orders touched a physical store in 2016. Ellison, a former Home Depot Inc. executive, took over the company in August 2015.

For the fourth quarter ended Jan. 31, J.C. Penney posted a profit of $192 million, or 61 cents a share, compared with a loss of $131 million, or 43 cents, the prior year. During the quarter, the company’s same-store sales fell 0.7 percent, compared with 4.1 percent growth in the previous year’s period. Revenue slipped 0.9 percent to $3.96 billion.

J.C. Penney reported its first annual profit since 2010 for the current fiscal year. The company was able to pull in a $1 million profit for the full fiscal year. Shares of J.C. Penney fell 9 percent after the earnings announcement. The stock has now dropped 25 percent so far this year.