What happened

Shares of Mastercard (MA 0.15%) took off in October, gaining 15.4% for the month, according to S&P Global Market Intelligence. The credit card giant's stock is down about 8% year to date, trading at roughly $328 per share as of Nov. 8.

Mastercard outperformed the major stock market indexes, including the Dow Jones Industrial Average, which had its best month since 1976, up 14%. It also beat the S&P 500, which rose 8%, and the Nasdaq, which climbed 3.9%.

So what

October was earnings month, and it was generally a pretty good one for Mastercard, which helped spur the stock higher. Mastercard posted Q3 results on Oct. 27, and its shares jumped after the company reported robust revenue and earnings growth, beating analysts' estimates.

It also occurred the same day that the U.S. Bureau of Economic Analysis released the gross domestic product (GDP) report for Q3, which saw the economy grow 2.6% after declines in the first two quarters of the year. It quelled recession fears, at least for now, and it was driven in part by increases in consumer spending. That's great news for Mastercard.

That boost in consumer spending bore out in Mastercard's third-quarter earnings, as net revenue climbed 15% year over year to $5.8 billion while earnings rose 6% to $2.58 per share on $2.5 billion in net income.

Its three key metrics were all up, plus gross dollar volume on its network jumped 11% year over year, cross-border volume gained 44% compared to last year, and switched transactions grew 9%.

"Consumer spending remains resilient and cross-border travel continues to recover," Michael Miebach, Mastercard CEO, said. He added:

We delivered strong revenue and earnings growth again this quarter, reflecting the focused execution of our strategy. We will continue to monitor impacts related to elevated inflation and other macroeconomic and geopolitical risks. Our diversified business model and ability to modulate expenses position us well to navigate through periods of uncertainty while maintaining focus on our strategic objectives.

Now what

Inflation did not effect Mastercard much in Q3, but if the economy slows down and inflation remains high, it could have an impact going forward.

While expenses were up 17% year over year, operating margin still remains high at 54.1%, down from 54.5% a year ago. But Miebach said on the earnings call that if the economic environment should weaken, the company is "prepared to act quickly to modulate our expenses." 

In the nearer term, the company expects revenue to grow in the mid-teens in the fourth quarter, which is in line with prior expectations, reflecting a bullish outlook on consumer spending and improved cross-border travel growth relative to 2019.

Longer-term, Mastercard could be impacted by legislation proposed in Congress that seeks to create more competition for Visa and Mastercard, so that is something to keep an eye on.

Otherwise, Mastercard remains resilient and is a solid buy.