Fertilizer producer Mosaic posted a higher-than-expected quarterly profit as higher prices helped offset a dip in phosphate sales and flat potash volumes.

The company warned that volumes may remain sluggish into the spring, as its distributors and farming customers remain cautious due to economic uncertainty.

While we expect third quarter results to decline due to near-term macroeconomic uncertainty and cautious distributor purchasing behavior, we remain confident of the strong long-term demand prospects for our products, Mosaic Chief Executive Jim Prokopanko said in a statement.

For the fiscal second quarter ended November 30, the company earned $623.6 million, or $1.40 per share, compared with $1.03 billion or $2.29 a share in the year-ago period.

Analysts expected earnings of $1.28 per share, according to Thomson Reuters I/B/E/S.

The year-ago results were helped by the one-time gain of the sale of a business.

Revenue rose 13 percent to $3.01 billion. Analysts expected $3.2 billion in revenue.

Potash and phosphate -- Mosaic's two main products -- are the second- and third-most important fertilizers for farmers to apply, after nitrogen.

Mosaic's average selling price for potash rose to $440 per tonne from $331 a year earlier. Volumes, at 1.8 million tonnes, were flat.

The company's average selling price for phosphate rose to $661 per tonne from $461, offsetting a 14 percent drop in volume.

Mosaic has complained that phosphate volumes are too low, and last week said it would cut phosphate production this year due to low prices for the nutrient.

The company is also battling in the courts for a permit that would let it expand a Florida phosphate mine.

Shares of Mosaic gained 0.6 percent to $52.59 in after-hours trading. The stock has traded between $44.86 and $89.24 in the past 52 weeks.

(Reporting By Ernest Scheyder; editing by Andre Grenon and Matthew Lewis)