McDonald's (NYSE:MCD) has tried to return to its roots and double down on the fast food at value prices that have fueled its success. That, along with its All-Day Breakfast menu, has led the chain to a turnaround.

In its most recent quarter, global comparable-stores sales increased 6.6%, reflecting positive guest counts in all segments. The chain's home market, the United States, wasn't up quite as much, but a same-store-sales increase of 3.9% is still impressive.

Revenue did decline by 3%, but diluted earnings per share (EPS) improved to $1.70 from $1.25 in Q2 2016. And for the first six months of the year, EPS is up 26%, jumping to $3.17 from $2.51, though overall revenue was down by 4%.

"For the quarter, we delivered our strongest global comparable sales and guest count results in more than five years," said CEO Steve Easterbrook in the Q2 earnings release. "We're now introducing our Velocity Growth Plan accelerators in more restaurants around the world, bringing meaningful benefits to more customers through digital, delivery, and our Experience of the Future."   

Despite those generally strong results and Easterbrook's strong management, it's not all clear sailing for the company. McDonald's continues to face a difficult operating climate, and there are reasons to believe its current success may not be sustainable.

The exterior of a McDonald's

McDonald's management has learned that the chain's customers don't want certain menu items. Image source: McDonald's.

What's next for McDonald's?

After efforts to offer higher-end healthier food failed, the company rebooted around its traditional offerings. That was a smart play by management, which accepted that if a consumer wanted to eat healthily, he or she probably wasn't going to pick McDonald's in the first place.

The chain also went back to innovating, adding its successful Signature Crafted burgers as well as bringing back chicken tenders. More importantly, the company has upped its technology game, adding ordering kiosks in some stores, using app-based ordering to speed up drive-thru service, and even rolling out delivery in a number of markets. In addition, McDonald's has invested heavily in its McCafe beverage program, which gives it the opportunity both to increase check size and add sales during non-peak times.

All of these moves, plus the expansion of the All-Day breakfast menu and a revised attempt at a Dollar Menu-like value offering, should drive sales in the near term. As that's happening, the conversion to the Experience of the Future model should remove some labor costs -- although the company has always said that wasn't the goal of the added technology.

Is McDonald's a buy?

The chain has proved to be resilient, and its sales have recovered after the company was caught unprepared by the rise of fast casual. It has also proved that it can execute fast food well, and demand for inexpensive burgers, fries, chicken nuggets, and the like remains high. One problem, however, is that there's no obvious sales driver like All-Day Breakfast on the horizon.

McDonald's has a lot of rivals, and Five Guys and Shake Shack are among the companies that take away its pricing power. Consumers will eat at the Golden Arches because it offers a product they enjoy that's relatively cheap. If they're willing to spend more, however, those rival chains become more enticing.

Still, this is a company that has remained a market leader through every manner of trend. That's likely to continue, and while there will be down quarters, the overall long-term direction remains up.

Consumers clearly like the food at McDonald's and will eat there as long as the price remains right. The company may succeed in expanding its beverage business, and it will certainly continue to become more efficient in how it operates.

This isn't a trendy pick, but the past few years clearly taught management a lesson: Give people what they want, but don't be complacent. Add menu items within your core competency (think a burger with triple bacon, not kale shakes), and execute really well. That's how the company turned things around, and it's a blueprint that makes the company a buy.

Daniel B. Kline has no position in any of the stocks mentioned. The Motley Fool is short shares of Shake Shack. The Motley Fool has a disclosure policy.