Shares of flavorings and spices leader McCormick (MKC 0.48%) were up 4% as of 12:45 p.m. ET on Thursday, according to data provided by S&P Global Market Intelligence.

McCormick delighted the market after reporting its second-quarter earnings, delivering $0.69 in earnings per share (EPS) compared to analysts' expectations of $0.59. The company's sales slipped by 1%, but its revenue was better than expected, with its flavor solutions segment selling to a food service industry that has seen tightened consumer spending so far in 2024.

McCormick continues to turn things around

The company is starting to see some signs of improvement across its margin profile following a brutal two-year stretch of high inflation.

MKC Gross Profit Margin Chart

MKC gross profit margin; data by YCharts. TTM = trailing 12 months.

Rising input costs due to inflation meant that the company had to play catch-up as it renegotiated higher prices in contracts with its retailing customers. With McCormick's gross profit margin rising for the fourth consecutive quarter -- after rising another 60 basis points in the second quarter -- the company continues to inch closer to its normal margins from three years ago.

Back-to-back quarters of 19% EPS growth show that management is delivering on the promises made in its initiatives for global operating effectiveness and comprehensive improvement. It could take time to see markedly higher sales growth. But having already raised its prices by 8% in 2023, and with U.S. restaurant volumes expected to be flat in 2024, McCormick is positioned to rebound when the economy improves.

A price-to-sales (P/S) ratio of 2.8 means McCormick could prove to be a blue chip stock trading at a fair price. The company would be trading at a below-market valuation of 21 times earnings if it can return to the 13.5% net profit margins it averaged prior to the high inflation of 2022 and 2023.