McDonald's (NYSE:MCD) this week posted fourth-quarter earnings results that capped the fast-food giant's best annual operating performance since 2012. Over the holiday period, Mickey D's managed sales gains across each of its global markets even as profitability shot higher. That good news was tempered just a bit by the fact that its pace of customer traffic gains slowed for the second straight quarter.

Here's how the headline results stacked up against the prior-year period: 

 Metric

Q4 2017

Q4 2016

Year-Over-Year Change

Revenue

$5.3 billion

$6 billion

(11%)

Net income

$699 million

$1.2 billion

(41%)

Earnings per share

$0.87

$1.44

(40%)

Data source: McDonald's financial filing.

What happened this quarter?

Sales growth decelerated slightly but kept up its market-beating pace. McDonald's also logged significantly higher earnings after backing out a one-time tax charge.

Four friends share a fast food meal.

Image source: Getty Images.

Highlights of the period include:

  • Comparable-store sales increased 5.5% to mark the second straight slowdown from the fiscal second quarter's blistering 6.6% spike. Yet McDonald's expansion still beat most large peers, including Starbucks and its 2% comps uptick.
  • Customer traffic rose across all of McDonald's major sales geographies. The key U.S. market enjoyed a 1% gain, compared to Starbucks' flat result and the 4% decline that Shake Shack recently posted. McDonald's enjoyed solid demand across its core menu, its value menu, and new product introductions.
  • A one-time tax charge sharply reduced reported profits. However, operating income grew at a healthy 9% pace to continue the chain's march into record profitability, thanks mainly to its refranchising efforts. Operating margin shot up to 41.9% of sales for the year, compared to 31.5% a year ago.

What management had to say

Executives were pleased with the results from the quarter and for the broader fiscal year. "2017 was a strong year for McDonald's," CEO Steve Easterbrook said in a press release, "as customers responded to the many ways we are making their experience more convenient and enjoyable."

A man takes a bite of a burger.

Image source: Getty Images.

Summarizing the progress the chain made through 2017, Easterbrook explained:

We served more customers more often, achieved our best comparable sales performance in six years, gained share in markets around the world and made tremendous progress with growth platforms such as delivery.

Can McDonald's keep it up?

Executives are hoping to keep that positive momentum going with help from an aggressive new value menu. Easterbrook and his team also aim to invest $2.4 billion in the business in 2018, with most of the funds going toward upgrading restaurants and deploying technology like kiosk ordering and delivery services.

Given that comps and traffic growth has now slowed for two consecutive quarters, it will be interesting to see whether McDonald's can continue stealing back lost market share in fiscal 2018. There's no question that it has plenty of progress to build on, though. Guest counts were up 1.9% for the full 2017 year to mark its first improvement on that metric since 2012.

The rebound was even more pronounced in the key U.S. market, were shopper growth was 1% last year compared to a 2% dive in the prior year. Management's goal of pushing profit margin up to the mid 40% range by 2019 looks easily achievable now, and that's a good reason for investors to celebrate since the metric was at 28% as recently as 2015.

Demitrios Kalogeropoulos owns shares of McDonald's and Starbucks. The Motley Fool owns shares of and recommends Starbucks. The Motley Fool is short shares of Shake Shack. The Motley Fool has a disclosure policy.