J.C. Penney Co Inc posted a narrower-than-expected net loss on Friday as the department store operator kept a tight lid on costs amid falling sales, and raised its profit forecast for the year.

The net loss was $1 million, or nil per share, in the second quarter ended August 1, compared with a year-earlier profit of $117 million, or 52 cents per share.

Analysts on average expected a loss of 1 cent per share, according to Reuters Estimates.

Earlier in August, the company said it expected a quarterly loss of 1 cent per share, much smaller than the per-share loss of 8 cents to 12 cents it had forecast earlier.

Sales fell 7.9 percent to $3.94 billion, Penney said.

J.C. Penney said it now expected to earn 75 cents to 90 cents per share this year, up from a prior forecast of 50 cents to 65 cents, driven by the second-quarter results and anticipated improvement in gross margin in the second half of the year.

The company's shares fell 2 percent to $32.66 in premarket trading.

(Reporting by Jessica Wohl in Chicago and Aarthi Sivaraman in Seattle; Editing by Lisa Von Ahn)