What happened

Shares of CF Industries Holdings (CF -0.33%) jumped more than 7% on Thursday after the fertilizer manufacturer reported quarterly results that came in above expectations. Investors had been worried about the impact of flooding in the Midwest and trade wars that have eaten into agricultural products demand from China, but so far CF is performing well despite the difficulties.

So what

Late Wednesday, CF said it earned $1.28 per share on revenue of $1.5 billion in the quarter, easily surpassing analyst expectations for $0.84 per share in earnings on $1.4 billion in sales. CF CEO Tony Will in a statement admitted it was "a challenging spring season," marred by record flooding in the U.S. Midwest that devastated farms across America's Corn Belt.

Farm equipment at work in front of a setting sun.

Image source: Getty Images.

Will said CF outperformed due to a shift in production mix toward higher-margin products, as well as leveraging the company's massive transportation network to work around the impact of flooding and get product to customers who needed it.

CF's overall earnings before interest, taxes, depreciation, and amortization (EBITDA) grew by 26% in the first half of 2019 compared to a year prior, to $973 million, on year-to-date sales of $2.5 billion, up 10% year over year.

Now what

Wills said he expects that strong demand in North America, coupled with "our position on the low end of the global cost curve," will drive cash generation in the second half of the year. Raw material costs could be a tailwind as well, with the company expecting the cost of natural gas for 2019 to be down more than 5% from 2018.

Shares of CF Industries have trailed the S&P 500 this year because of concerns about the health of the agriculture sector and issues, like flooding, that were beyond the company's control. The bull case from here would be for farmers to aggressively buy fertilizer to try to make up for a bad start to 2019. The bear case is built around the continued threat of trade wars and other factors that could eat into ag product demand, and in turn reduce farmers' ability to buy fertilizers and other goods.

If nothing else, the first half of the year for CF Industries was not as bad as investors feared it could have been. That's enough to justify a relief rally on Thursday.