U.S. hog futures closed sharply higher on Thursday as investors continued to cover short positions in response to stronger cash hog prices, analysts and traders said.

Traders also cited the stock market rally, which triggered fund buying in several commodities.

Live cattle futures posted modest gains, while feeder cattle rose sharply.

CME hogs rose as hot weather in the Plains and high feed costs forced producers to grow their animals to lighter weights, causing some packers to scramble for supplies.

"Hogs didn't put on weight because of the heat. So, it takes more hogs to make up a load to send to market, which is holding this (futures) together," said independent hog futures trader Bill Cipolla.

The U.S. Department of Agriculture estimated on Thursday morning that the average hog price in the closely watched Iowa/southern Minnesota market at $95.60 per cwt, up $1.41 from Wednesday.

Spot August closed 1.250 cents higher, or 1.32 percent, at 95.800 cents per lb. Most-actively traded October finished 1.225 cents higher, or 1.53 percent, at 81.425 cents.

August traders kept pace with the CME's lean hog index at 95.92 cents. The spot-month expires on Aug. 14. Spreaders sold August and bought October, lifting it beyond the 20-day moving average of 80.99 cents, which touched off fund buying.