What happened

Shake Shack (NYSE:SHAK) shares were cooking up something special today as the high-end fast-food chain posted strong second-quarter results and announced a new partnership with Grubhub (NYSE:GRUB), signaling its intent to dive further into the fast-growing app-based food delivery trend.

Shares were up 17.7% as of 2:51 p.m. EDT, touching a four-year high.

A Shake Shack burger.

Image source: Shake Shack.

So what

The burger chain said sales jumped 31.3% to $152.7 million, breezing past estimates of $149.5 million, on a same-store-sales increase of 3.6%. This matches its first-quarter clip, which was its strongest growth rate in that category in years.

Restaurant-level operating margin continued to decline, falling from 28.2% to 24.4%, as the company opened locations in new markets, away from its core base in New York, where it will need to take time to build out its brand. Increased labor costs, additional paper costs from its embrace of delivery, and higher food costs from its rollout of Chick'n Bites as well as in beef and dairy contributed to the compressing margin. That led to adjusted earnings per share actually falling in the quarter from $0.29 to $0.27, but that still beat estimates at $0.23.

What also delighted investors was the company's decision to forge a partnership with Grubhub, making the Seamless parent its national delivery partner, a deal that will include direct-to-POS integration and Grubhub's Just in Time technology that ensures that orders are delivered faster and food is fresher.

Shake Shack CEO Randy Garutti summed up the company's position following the quarter, saying, "Overall, we have strong and positive momentum across the business heading into the second half of the year and continue to execute well against a robust domestic and international development pipeline, while also testing new Shack formats, and increasing accessibility and convenience through ongoing digital innovation."

Now what

On top of the better-than-expected results and the partnership with Grubhub, Shake Shack also raised its guidance for the year. The fast-food chain is calling for revenue of $585 million to $590 million, up from a previous range of $576 million to $582 million, and sees same-store sales growth of about 2%, up from 1% to 2%.

After several quarters of uninspiring same-store sales growth, the company finally seems to be hitting its stride. Though the stock is pricey according to conventional definitions, trading at a triple-digit P/E ratio, investors are happy to pay a premium, because they see a boom in restaurant sales from places like Shake Shack thanks to the rapid growth of delivery apps.

Following today's jump, the stock is up 91% so far this year. There's no doubt that much of that gain can be attributed to the rapid expansion of app-based food delivery.