Shares of McDonald's (MCD 0.37%) performed well in 2022, beating a down market thanks to solid demand in the fast-food industry. The chain enjoyed higher customer traffic in most markets and was mostly able to pass along higher costs by raising menu prices.

Currency exchange rates hurt earnings, to be sure, but its huge scale helped Mickey D's stay ahead of rivals like Chipotle (CMG -1.34%).

The year ahead will bring different challenges, though. Some of those will be clear from the company's upcoming earnings report in late January. With that backdrop in mind, let's see if McDonald's still looks like an appetizing stock to keep in your portfolio for 2023.

Convenience is king

McDonald's had strong momentum heading into Tuesday's earnings announcement, which covers the fourth-quarter period through late 2022. Comparable-store sales were up 10% in the third quarter thanks to rising customer traffic in all its selling regions, plus higher prices.

"Our ... performance demonstrated broad-based business momentum," CEO Chris Kempczinski said in a late-October press release. Investors are hoping to hear a similarly positive update in late January.

There were signs of weakness, though. McDonald's U.S. sales growth slowed to 6.1% -- less than the 7.6% increase that Chipotle achieved for the same period. The two chains are increasingly battling in the drive-thru arena as Chipotle targets more growth outside of metropolitan areas.

Cash and profits

McDonald's stock is likely to keep delivering solid returns if its finances continue to impress. Like most peers, its margins shrank last year as prices soared and demand growth slowed. But the chain's heavily franchised model helped protect earnings. Operating profit margin is still running higher than 40% of sales, compared to Chipotle's 12%.

MCD Operating Margin (TTM) Chart

MCD operating margin, data by YCharts. TTM = trailing 12 months.

It is encouraging that McDonald's was able to keep customer traffic rising through the third quarter while boosting prices. If the company can maintain those trends into 2023, then there's a good chance that earnings will continue expanding at a solid clip.

Returns are also being bolstered by the dividend, which in late 2022 was raised for the 46th consecutive year. Shareholders in 2023 will be collecting a 10% higher payout.

Is the price right?

Much of this good news is reflected in McDonald's valuation, which is at a premium today. You have to pay nearly nine times annual sales for the stock, while Chipotle is priced at about five times sales. McDonald's valuation didn't come down much as the market fell in the past year, too, while Chipotle had been trading for nearly eight times earnings as recently as 2021.

McDonald's isn't as exposed to the risks associated with a recession thanks to its wider selling footprint, its value menu focus, and its franchised operations. Those factors help explain why the restaurant stock did so well in 2022. The business can grow during boom times, too, as McDonald's demonstrated after pandemic restrictions eased in 2021 and 2022.

Toss in the growing dividend and you have all the necessary ingredients for a great stock to hold over the long term. McDonald's is highly likely to keep gaining market share in a huge global industry while generating profits that its smaller peers can only dream about. Consider adding this stock to your portfolio or your watch list for 2023.