It's been a long, hard road for investors in small-town convenience outfit Casey's General Stores (NASDAQ:CASY). While the company's focus on pizza delivery produced huge gains coming out of the Great Recession, the stock has trailed the broader market by over 50 percentage points since July 2016.

A perfect storm of factors contributed, including weak farming economies where the company operates, massive expansion plans that have been confronted with heavy competition, and a management team that has done a subpar job of managing investor expectations.

With the company's fiscal first-quarter earnings report this week, however, there's a respite -- and signs of hope.

Profile view of a young woman paying with a credit card to a store clerk in a supermarket

Image source: Getty Images.

Casey's General Stores earnings: The raw numbers

Before we dive into what made the quarter such a success, let's look at how the company performed on the headline numbers.

Metric Fiscal Q1 2019 Fiscal Q1 2018 Growth
Revenue $2.59 billion $2.09 billion 24%
Earnings per share $1.90 $1.46 30%

Data source: Casey's earnings report.

Because Casey's relies on gasoline sales for the bulk of its revenue, it isn't necessarily helpful to look directly at sales figures to gauge the health of the company. Casey's -- after all -- has very little control over the price of gas.

Diving deeper into the results

To really get a feel for how the company is faring, it's helpful to look at how its three reporting segments -- fuel, groceries, and prepared food -- have performed on a comparable-store basis (comps). This helps investors see how popular the business really is, and filters out any growth that occurs from new stores. It also helps to look at what the company was predicting.

Last quarter, management laid out much more modest expectations. Here's what they were, and how the company performed against those expectations.

Metric Fiscal 2019 Goal Goal Met? Q1 2019 Results
Fuel comps 1.5% to 3% No 0.5% growth
Fuel margin $0.185 to $0.205 Yes $0.205
Grocery comps 1.5% to 3% Yes, exceeded 3.2%
Grocery margin 31.5% to 32.5% Yes 32.4%
Prepared food comps 1.5% to 3% Yes 1.7%
Prepared food margin 60% to 62% Yes 62%

Data source: Casey's earnings release.

Yes, fuel fell short of expectations, but this was largely due to higher gas prices. And the fact that margins came in on the high end of the forecast helped offset this weakness.

The real story here is the fact that the company's grocery and prepared food comps met or exceeded goals. Over the past two years, this simply hasn't been the case. Management said that packaged beverages were particularly strong for the grocery segment. Breakfast foods did exceptionally well for prepared foods, helping offset some weakness in the company's bakery (read: doughnuts) offerings.

But perhaps most important, according to the company's earnings release, "Increased investment in pizza promotions did not significantly affect our margin." That's a big deal for the time being.

Value creation plan

Part of the reason the company could pull off promotions without hurting margins is because of its value creation plan. Much of the company's press release focused on how Casey's is cutting costs across its segments.

A lot of ink was devoted to talking about price optimization for both the company's fuel sales, and its in-store offerings. In plain English, this means that management has jumped on the big data bandwagon and is now harnessing the power of all of its purchasing data to help stores set prices that find the right balance between sales to draw customers in and mark-ups to help the bottom line.

This, combined with the discontinuation of several 24-hour delivery models at stores, helped keep operating expense growth to a modest 12%. That's particularly impressive considering that the company had 105 more stores in operation than the same time last year.

Adding to the momentum, Casey's also expects to launch its "fleet" rewards card program in the coming quarter, which management believes will drive further traffic both outside (fuel) and inside (grocery and prepared food) the store.

Management also announced that it had bought back over 350,000 shares at an average price of just under $100 per share. Given that the stock is currently trading at over $130 per share, that looks like a prudent move.

Looking ahead

Another reason that Casey's stock was trading up following the earnings release has to do with the forecast for the rest of the year. While management maintained most of its expectations across the company's segments, it bumped up its outlook for prepared food comps from 2.25% to 2.5%. That might seem like an insignificant amount, but given the trend over the past year-plus of downward revisions, this was a welcome sign for investors.

Casey's is currently benefiting from two major forces: its price optimization efforts and the fact that its store remodels are slowing significantly, leaving more money to be spent elsewhere. While management needs to continue executing on the value creation plan, it's not going to be a recurring force investors can count on. That's why keeping an eye on comps is so important.

Brian Stoffel has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Casey's General Stores. The Motley Fool has a disclosure policy.