Fertilizer producer CF Industries Holdings Inc (CF) posted a lower-than-expected second-quarter profit on Monday due to falling demand after an aggressive spring planting season.

Low natural gas prices helped boost profit, as did share repurchases, but farmers bought less nitrogen and phosphate from CF after buying so much in February and March.

CF said it expected the sales decline to be temporary and forecast "robust" application of ammonia fertilizer this fall and "high" plantings of corn in 2013.

In 2012, U.S. farmers planted the largest area to corn in 75 years, but drought in the Midwest has slashed corn production prospects.

The drought is seen as bullish for fertilizer producers as U.S. farmers will need to plant even more corn in 2013 to make up for loss in yield this year.

Investors seemed not to be perturbed by the rare earnings miss, and CF shares rose 2.7 percent to $209 in after-hours trading.

CF posted second-quarter net earnings of $606.3 million, or $9.31 per share, compared with $487.4 million, or $6.75 per share, a year ago.

Excluding one-time items, CF earned $8.65 per share. By that measure, analysts, on average, had expected earnings of $8.91 per share, according to Thomson Reuters I/B/E/S.

Revenue fell 4 percent to $1.74 billion. Analysts, on average, had expected $1.95 billion in revenue.

The company bought back 3.1 million shares in the quarter, boosting its earnings per share by 19 cents. CF also recorded a non-cash gain of $77.6 million related to the decline in the price of natural gas.

Lower natural gas prices helped cut supply costs in CF's nitrogen unit, it's largest, by 29 percent. That was offset by a decline in demand, and the unit's sales were unchanged at $1.5 billion.

CF sold 3.5 million tons of nitrogen products in the quarter, down from 3.8 million tons a year ago.

Nitrogen is the most important crop nutrient for farmers to apply, followed by phosphate.

CF sold 493,000 tons of phosphate during the quarter, down from 538,000 tons. The decline was partly due to new product development in the quarter, CF said.