Image source: Getty Images.

What: Shares of AK Steel (AKS) surged on Wednesday and were up 11% at 10:45 a.m. EDT on the heels of its strong second-quarter results.

So what:  AK Steel delivered a surprise profit, announcing that it earned $0.08 per share, which was well ahead of the $0.02 per-share loss that analysts were expecting. According to CEO Roger Newport, driving AK Steel's strong showing was its "strategic decision to reduce exposure to commodity spot markets, optimize our footprint and focus on higher value products." In fact, shipments of value coated products increased to 53% of total shipments, up from 45% in the year-ago quarter. That said, total shipments slumped 14% year over year, to 1.55 tons.

As a result of the focus on higher-value products, AK Steel's average selling price improved to $957 a ton, which is up 2.8% over last year's second quarter. In addition, its operational improvements and cost reduction initiatives pushed operating expenses down by 15%.

AK Steel was one of several steelmakers to report surprisingly strong second-quarter results due to rising steel prices and falling costs. Nucor (NUE -1.04%), for example, saw a 9% increase in the average sales price per ton during the quarter due in part to the government's efforts to address product dumping by foreign competitors. Meanwhile, lower energy costs resulted in a $5 per-ton year-over-year decline in Nucor's costs. These factors drove a significant improvement in Nucor's bottom line, with its earnings surging to $233.8 million, or $0.73 per share, which beat the consensus estimate by $0.03 per share, and was up from $124.8 million, or $0.39 per share, in the year-ago quarter.

Now what: Steelmakers worked hard to turn around their operations by slashing costs and optimizing production. Those moves are paying off big time now that the steel market is showing some signs of improvement. That puts AK Steel in the position to have a better year than initially anticipated.