June 6 (Reuters) - Jif peanut butter maker JM Smucker topped Wall Street estimates for fourth-quarter profit on Thursday, helped by higher prices of condiments and frozen food as well as lower input costs, sending its shares up 2% before the bell.

Benefits from price hikes helped the company shield its margins from rising costs of coffee. It further benefited from manufacturing and commodities prices coming down from their peak.

The Dunkin' pre-made coffee maker's gross margin rose 41.4% in the quarter.

On an adjusted basis, the company posted a quarterly profit of $2.66 per share, above market estimates of $2.33, according to LSEG data.

While the company increased prices to counter soaring raw material costs, it struggled with weaker demand as consumers grappled with still-high living costs traded down to cheaper alternatives.

JM Smucker's quarter sales dropped 1% to $2.21 billion, slightly below analysts' estimates of $2.24 billion.

Net sales for the company's domestic retail pet food segment declined 42% in the quarter ended April 30 after rising 9% last year owing to higher prices.

Last month, larger peers Kraft Heinz and Hormel Foods also reported quarterly sales below estimates owing to sluggish demand.

"In response to recent higher green coffee costs that we will begin to incur during the first quarter, we are taking a list price increase across parts of our portfolio in early June," CEO Mark Smucker said.

The Orville, Ohio-based company forecast annual sales of 9.5% to 10.5%, slightly above estimates of 9.85%. (Reporting by Anuja Bharat Mistry in Bengaluru; Editing by Ravi Prakash Kumar)