Image source: McDonald's.

When the broad market is surging, even a mediocre company can deliver strong returns. On the other hand, sometimes such a stock can rise even while global markets are going through considerable turmoil. Case in point: McDonald's (NYSE:MCD) stock is up by an impressive 35% over the past year and trading at fresh historical highs. 

Let's look at the main reasons behind this big gain for McDonald's stock in a challenging environment and, perhaps more important, what the future could bring for investors in the fast-food giant.

A happy meal for investors
McDonald's has faced considerable challenges over the past several years. The company owns over 36,000 stores serving nearly 69 million customers in 100 countries around the world. Once you reach that scale, it's not easy to find growth opportunities in a mature industry. Making things worse, consumers are increasingly inclined toward healthier nutrition, and fast-casual restaurant chains offering a greater number of healthy products are gaining ground versus traditional fast-food players such as McDonald's. In this environment, McDonald's has suffered from stagnant or even declining sales since 2013. 

However, things started improving under the leadership of Steve Easterbrook, who assumed the CEO position last March. McDonald's is revamping its operations, closing unprofitable stores, and betting on menu innovation to jump-start growth. While it's too early to tell if the company is definitively out of the woods, McDonald's is clearly moving in the right direction.

The company had already announced encouraging sales data for the third quarter of 2015. Global comparable sales increased 4% year over year, and comparable sales in the U.S. increased for the first time in nearly two years, rising by a modest 0.9%.

Even better, the recovery gained steam in the fourth quarter, confirming that McDonald's is on the right track. Global comparable sales grew 5% during the quarter ended in December, and comparable sales in the U.S. jumped by a surprisingly strong 5.7%. McDonald's launched its all-day breakfast menu in October, a major victory for the company in its home market. If McDonald's can sustain its recovery in the U.S. over the coming years, this could be a huge positive in terms of overall financial performance.

Importantly, CEO Steve Easterbrook believes the company already moved beyond the transition phase in 2015, so the business is well positioned to deliver growing sales in 2016 and beyond. In Easterbrook's words:

We took bold, urgent action in 2015 to reset the business and position McDonald's to deliver sustained profitable growth. We ended the year with momentum, including positive comparable sales across all segments for both the quarter and the year-a testament to the swift changes we made and the early impact of our turnaround efforts. We enter 2016 committed to managing the business for the long term and aligned as a System around the critical imperative that we must run great restaurants each and every day for our valued customers.

Time to buy?
When comparing valuation ratios for McDonald's versus other restaurant chains such as Yum! Brands (NYSE:YUM) and Chipotle Mexican Grill (NYSE:CMG), the company doesn't look too expensive.

CompanyMcDonald'sYum! BrandsChipotle
P/E 26 33 27
Forward P/E 22 19 35
Dividend yield 3% 2.7% N/A

Data source: Yahoo! Finance.

Comparisons are not very straightforward, as the three companies have their own weaknesses and strengths. Chipotle Mexican Grill is much smaller than McDonald's and Yum! Brands, and the company has delivered explosive growth rates over the past several years. Chipotle Mexican Grill is being hurt by an E. coli outbreak that's weighing on sales in the middle term. However, the company will most probably recover from this setback over time, and Chipotle offers much bigger potential for growth than McDonald's or Yum! Brands in the long term.

Yum! Brands is more like McDonald's in terms of size and market penetration in the United States. However, Yum! Brands made a big bet on China over the past several years. The company owns 6,900 stores in the country, and management believes it has enough room for 20,000 units or more in this key market. The business in China has been facing considerable volatility lately, and Yum! Brands has announced its plan to spin off those operations to improve its focus and execution in the United States.

Both Chipotle Mexican Grill and Yum! Brands are going through considerable uncertainty in the short term, and this situation can make valuation comparisons tricky. However, the main point remains that McDonald's stock is valued in line with other big restaurant chains, so valuation is no reason to stay away from the company. 

In addition, McDonald's has an amazing track record of dividend growth. The company has increased dividends in each and every year since paying its first dividend in 1976. The dividend yield is currently around 3%, and McDonald's has rewarded investors with $9.4 billion in dividends and buybacks over the past year. This is a lot of money, even for a gigantic corporation such as McDonald's, as capital distributions over the past 12 months amount to more than 8% of the company's market capitalization.

McDonald's is a market leader in a stable and mature industry, so investors shouldn't expect explosive growth from the company over the coming years. However, as long as sales keep moving in the right direction, McDonald's could deliver solid returns while rewarding investors with succulent capital distributions via dividends and buybacks.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.