What happened

Kraft Heinz (KHC -0.37%) shareholders are trouncing the market this year. Their stock jumped 6% in the first half of 2022, according to data provided by S&P Global Market Intelligence, compared to a 21% drop in the S&P 500.

That outperformance also puts Kraft Heinz ahead of many peers in the packaged foods space, including PepsiCo and McCormick. The rally was supported by a tilt in investors' interest toward more stable businesses that might fare better through any upcoming recession. It was also powered by solid operating results that suggest Kraft Heinz can continue boosting sales and earnings despite rising inflation pressures.

So what

Kraft Heinz stock jumped following its early February earnings report, which contained plenty of good news about the business. Organic sales rose 4% even compared to a spike a year earlier. Essentially all of that growth came from higher prices, although it was also considered a win for the business that sales volumes held steady.

The operating news got better as the year progressed. Management said in late April that organic sales gains accelerated to 7% at the start of fiscal 2022, thanks to growth across each of its geographic markets. Volumes declined in the period, yet Kraft was able to more than offset those drops by aggressively raising prices. Operating income rose 2% to $1.1 billion in Q1. "Our first quarter was a strong start to the year," CEO Miguel Patricio said in a press release.

Now what

Kraft's stock rally will be tested in a few weeks when the company announces fiscal second-quarter results on July 27. Heading into that report, most investors are optimistic about the business's potential. Kraft executives raised their sales outlook in April and currently project that organic sales will rise in the mid-single-digit range. The company affirmed its earnings outlook at that time, too, despite accelerating cost pressures.

The late July report might stall the stock's rally if it reveals that Kraft was unable to continue raising prices aggressively without sparking deeper volume declines. Yet shares don't look particularly expensive today. Kraft Heinz is valued at 1.9 times sales, compared to a 2.9 price-to-sales ratio for PepsiCo and a ratio of 4 for McCormick.

Sure, the packaged foods giant isn't growing as quickly as these rivals, and its market position isn't as strong. However, if the company can continue executing well in this volatile demand and cost environment, then investors might continue pushing its shares higher in 2022. Over the longer term, Kraft Heinz returns will depend on management's ability to capitalize on its portfolio of leading food brands through innovative product introductions.