Source: McDonald's.

McDonald's (MCD -1.26%) stock is firing on all cylinders lately. Shares of the fast-food giant are up by more than 30% from their lows of the last year, trading near historical highs in the neighborhood of $112 per share. However, the past is only prologue to the future, and investment decisions need to be based on forward-looking considerations, not past performance. Is now the right time to buy McDonald's?

Investors are lovin' it
McDonald's has faced stagnant or even declining revenues since 2013, due to both company-specific factors and a changing industry landscape. The company lost its touch with consumers, and menu innovations over the last few years failed to gain much traction. In addition, the trend toward healthier nutrition is a major headwind hurting fast-food companies across the board.

In this context, investors rejoiced when McDonald's announced encouraging sales data for the third quarter. While sales in U.S. dollars declined 5% during the quarter, this was due to currency fluctuations since constant currency sales increased by a strong 7% versus the same quarter in the prior year. Importantly, global comparable sales grew 4% on the back of positive performance across all segments.

Comparable sales in the high-growth emerging markets segment grew by a vigorous 8.9% on the back of strong performance in China. The international lead markets segment delivered a 4.6% increase in comps due to solid growth in Australia, the U.K., and Canada. The big news came from the U.S., where McDonald's experienced a 0.9% jump in comps. This is quite a modest increase, but it's also the first time McDonald's has delivered positive quarterly comps in the U.S. in the last two years.

Adding to the optimist tone, CEO Steve Easterbrook said in the press release that McDonald's is on track for a sustained recovery in the coming months:

Third quarter marked an important step in the company's global turnaround -- the reorganization of our business from a geographically focused structure to business segments that combine markets with similar characteristics and opportunities for growth. As we begin fourth quarter, comparable sales are expected to be positive in all segments. While still in the early stages, we believe our turnaround plan is starting to generate the change needed to reposition McDonald's as a modern, progressive burger company.

On the wrong side of the trend
Big, established fast-food chains such as McDonald's and Yum! Brands (YUM 0.39%) are facing considerable challenges in the years ahead. The restaurant industry is notoriously competitive, and consumers are moving away from traditional fast-food chains and toward fast-casual players offering higher-quality ingredients and fresher menus. Multiple factors such as health considerations, menu flavor, and cultural values are in play here, so it won't be easy for these companies to reverse the trend.   

Chipotle Mexican Grill (CMG 0.89%) is the poster child from the fast-casual revolution, and comparing Chipotle's sales growth against that of both McDonald's and Yum! Brands shows that the company has gained tons of market share against its bigger rivals over the last several years. 

MCD Revenue (TTM) Chart

MCD Revenue (TTM) data by YCharts.

Based on data for the last quarter, Chipotle continues stealing market share from big industry players. Yum! Brands reported an anemic increase of only 2% in total revenue during the third quarter of 2015, while Chipotle's revenues grew by a much more succulent 12.2% versus the same quarter in the prior year.

Chipotle is still relatively small in comparison to McDonald's and Yum! Brands. The company is expected to bring in $4.7 billion in revenue this year versus $25.3 billion for McDonald's and $13.2 in forecasted sales for Yum! Brands. Even if Chipotle's growth slows down as the company gains size over time, Chipotle and other fast-casual players still have plenty of room to continue gaining market share against giants such as McDonald's and Yum! Brands.

Is it the right time to buy McDonald's?
One quarter with positive sales news does not make a trend, and while it's good to see McDonald's making some progress, it's far too early to say that the company is definitively out of the woods. Besides, the stock is trading at a premium versus the general market: McDonald's carries a price-to-earnings ratio of 26 times earnings over the last year, while the average company in the S&P 500 trades at a price-to-earnings ratio around 18.

Its current valuation seems to be reflecting optimistic expectations for McDonald's, and the company is facing major headwinds due to changing consumer demand in the years ahead. From this point of view, the risk and reward trade-off for investors in McDonald's stock does not look very appetizing.