Johnson Controls Inc. (JCI) posted its first profitable quarter since last autumn as the auto-parts and heating-systems maker saw cost cuts partially take the sting out of tumbling demand, which fell more than expected.

Chief Executive Stephen A. Roell, who had predicted the return to the black in April, said Monday conditions in most of the company's markets "remain very challenging." Nevertheless, the company reported earnings above analysts' estimates, and Roell said Johnson Controls is "well positioned" to further increase profitability in coming quarters.

The company gets nearly half of its revenue by producing commercial building equipment and services, but it also derives well over a third from making automobile seats, interior systems and batteries.

Johnson Controls reported a profit of $163 million, or 26 cents a share, down from $439 million, or 73 cents a share, a year earlier. Sales dropped 29% to $7 billion.

Analysts surveyed by Thomson Reuters were expecting earnings of 18 cents a share on revenue of $7.4 billion.

Gross margin fell to 14.9% from 15.1%.

The automotive unit swung to a small loss as sales tumbled 38%, with North American auto-industry production down 48% amid shutdowns at General Motors Co. and Chrysler Group LLC. European output fell 27%, Johnson Controls said.

Johnson Controls' building operations saw its earnings drop 37% on a 14% sales decline.

Shares closed Friday at $21.52 and was inactive premarket. The stock is up 19% this year.

-By Mike Barris, Dow Jones Newswires; 212-416-2330; mike.barris@dowjones.com