Stocks couldn't settle on a direction today. After crossing in and out of positive territory a half-dozen times, the S&P 500 (^GSPC -0.48%) ended down 0.1% while the Dow Jones Industrial Average (^DJI 0.58%) was unchanged.

^INX Chart

^INX data by YCharts

Yet two consumer goods companies made big moves, even as the broader market jogged in place. Keurig Green Mountain (GMCR.DL) and J. M. Smucker's (SJM 2.65%) were the S&P 500's two best-performing stocks on the day.

Keurig brews up surprising profits 
Keurig Green Mountain spiked 18% higher on nearly ten times its average trading volume. The home beverage machine maker beat Wall Street's (low) third-quarter earnings expectations. Sales fell 13% to $1.04 billion, or just better than the $1.03 billion figure that analysts were targeting. Profits sunk 15% to $0.85 per share, or $0.14 per share above consensus estimates.

Image source: Keurig.

Cost cuts helped Keurig outperform those earnings expectations. "I'm particularly pleased with the benefits realized from our cost reduction efforts as well as our strong cash generation, both of which exceeded expectations in the fourth quarter," CEO Brian Kelley said in a press release. The financial improvement gave management confidence to boost the dividend payout by 13%.

Still, the business suffered from sharply weakening demand: Keurig sold 20% fewer brewing machines and 4% fewer pods than in the year-ago period . Yet with the stock lower by 60%, year-to-date, heading into today's report, most of that bad news was reflected in the share price. Meanwhile, short interest represented 15% of the company's outstanding share count. It's possible that many of those short positions were being covered today as Keurig's business didn't collapse to the extent that many investors feared it would.

Smucker's caffeine-powered earnings growth
Consumer foods giant J.M. Smucker's stock rose 7% and set a new high in the wake of a strong third-quarter earnings announcement. Its 40% sales gain, powered by a major expansion into the pet food business, was in line with analyst targets. But Smucker's 36% bounce in operating income, translating into $1.62 in per share earnings, soundly beat Wall Street's $1.51 per share profit forecast.

At the same time, gross margin jumped by more than a full percentage point – up to 38% of sales. "We are pleased to have delivered another quarter of solid financial results, which reflects the momentum we are seeing across our businesses," CEO Richard Smucker said in a press release .

Some of Smucker's most popular brands. Image source: Smucker's.

Smucker's can thank caffeine for much of that healthy momentum. Its coffee business posted double-digit volume growth, led by gains in the Folgers brand and in Dunkin Donuts branded K-Cup pods. Earnings for the segment improved by 7% to reach $162 million. And it remained extremely profitable -- generating $0.28 of profit for each $1 of sales. In contrast, Smucker's U.S. food business was good for a 20% profit margin as revenue ticked lower on price cuts in the Pillsbury and Jif brands.

The company forecast a strong overall finish to its 2016 fiscal year. Sales are projected to rise 40% through the next six months. Yes, most of that gain will come from the new Big Heart pet business, but Smucker's other divisions, ranging from coffee, to packaged foods, to international foods, are projected to grow by a steady 3% this fiscal year.