Building materials company Gibraltar Industries said its fourth-quarter operating results swung back to a profit, as company initiatives to strengthen the performance of the business in the past year paid off despite flat sales.

The Hamburg-based company reported adjusted net income of $1.5 million, or 5 cents per share, compared with an adjusted loss of $5.1 million, or 17 cents per share, in the fourth quarter a year ago. The earnings were better than the 3 cents per share analysts were expecting.

Adjusted results for the recent quarter don’t include $5.2 million, or 17 cents per share, in after-tax special charges for impaired assets, costs related to acquisitions and expenses from restructuring and exiting businesses. Special charges from a year ago totaled $1.8 million, or 5 cents per share.

Including those items, the company reported a net loss of $3.7 million, or 12 cents per share, improved from a net loss of $6.9 million, or 22 cents per share, a year ago.

“We concluded 2012 with strong year-over-year profit improvement in the fourth quarter, achieved without the benefit of meaningful change in order volumes,” said Chairman and Chief Executive Officer Brian Lipke. “As a result of this performance improvement, 2012 was a better year for Gibraltar than 2011, and was our second consecutive year of accelerating earnings growth, despite historically low levels of activity in our traditional core markets.”

Sales for the fourth quarter fell less than 1 percent to $173 million, while the cost of sales fell 5 percent to $141 million.

About 40 percent of sales comes from industrial markets and 10 percent from infrastructure markets, with demand for bridge and highway construction work “a bright spot for us,” said Henning Kornbrekke, president and chief operating officer. Much of that is related to large, long-term projects driven by federal transportation funding.

In contrast, he noted, demand and activity in the European automotive and North American oil and gas industries remained stable for the second straight quarter.

Meanwhile, the company’s business tied to residential and low-rise construction faced “another quarter of generally soft end-market demand,” he said. And despite “optimistic forecasts” from the company’s customers, Gibraltar doesn’t expect to see stronger sales until homebuilding picks up late in the first quarter and into the second quarter, “and housing plans become actual projects.”

Instead, he said, the company has been focused on controlling expenses, managing commodity costs, lowering working capital, reducing borrowings, generating cash flow and expanding margins. Selling, general and administrative expenses fell 22 percent.

For the full year, adjusted net income rose 32 percent to $20.2 million, or 65 cents per share, from $15.3 million or 50 cents per share. Adjusted results excluded $7.5 million, or 24 cents per share, in special charges in 2012 and $6.1 million, or 20 cents per share, in 2011.

Including special items, net income rose 38 percent to $12.7 million, or 41 cents per share, from $9.2 million, or 30 cents per share in 2011. Sales rose 3 percent last year to $790.1 million.

Looking ahead, Lipke said the company is more optimistic that positive trends in its markets will continue, resulting in improved profitability. Gibraltar also will benefit from lower interest expenses after refinancing debt three weeks ago. And it completed three purchases in the fourth quarter that will add to earnings this year. Additionally, it now has more products in more major retail stores than at any time in its history.

“We are confident that we can extend this record of bottom-line growth during the year ahead,” Lipke said.