Before the end of 2016, perhaps while loading their minivans and Malibus with Christmas presents, Americans are expected to blow past a major milestone. For the first time since the financial crisis, they’ll be carrying more than $1 trillion in credit card debt.

That high-water mark is actually an encouraging sign of economic recovery. (The consumer is back, baby!) But it also hints at the enduring success of the credit card industry, especially its four best-known brands—the ones whose names adorn those “Accepted Here” decals at the cash register. Since the Great Recession, Visa, MasterCard, American Express, and Discover have become increasingly efficient profit machines. In 2016 they’re on track to post $20 billion in earnings on $70 billion in revenue, according to S&P Global, up from $9.6 billion and $48 billion, respectively, in 2010.

The companies can credit their success to a combination of smart adaptation and good timing. After the financial crisis, regulators crimped the card giants’ revenue by capping or cutting their fees. But regulators also helped the industry by curbing big banks’ other business lines, like proprietary trading and riskier lending—­leaving the issuance of new credit cards as one of the financial sector’s few reliable sources of growth.

Technological change also gave card companies a tailwind, as e-commerce and faster processing systems enticed consumers to choose plastic over cash and checks. Credit, debit, and prepaid cards now account for two-thirds of noncash trans­actions, up from one-third in 2000, according to the Federal Reserve. And while many Silicon Valley seers thought mobile-payment platforms like PayPal pypl and Apple Pay aapl would threaten the card oligopoly, the old guard has largely co-opted the upstarts, making their own services compatible with the new generation of apps. Fintech “used to be seen as the great threat,” says Jim Sinegal, equity analyst at Morningstar, but for now digital innovators are “just incorporating the existing ecosystem.”

INV.12.01.16.chart

Of course, there’s no guarantee the stars will continue to align for the Big Four, especially if a downturn dampens consumers’ exuberance—so investors should be selective. MasterCard and Visa have less to fear from tough economic times. They derive most of their revenue from processing payments among merchants, banks, and spenders, which means they don’t get stuck holding bad debts if consumers struggle to pay their bills. MasterCard ma has expanded aggressively overseas, where credit card adoption is growing much faster than in the U.S. In July it bought VocaLink, a competitor to PayPal’s Venmo in person-to-person payments. And Sinegal says MasterCard has been “the most aggressive of the credit card firms” in monetizing data about spending patterns—big data indeed, given the 1.6 billion MasterCard-branded cards in circulation.

Still, at 24 times expected 2017 earnings, MasterCard’s stock looks pricey. Visa v isn’t a bargain either, at 21 times next year’s earnings, but analysts say its advantages in scale (it processes between 50% and 60% of global ­electronic payments) and technology justify its valuation. Its Visa Checkout mobile app has more than 15 million customer accounts, and Bob Napoli, analyst at investment bank William Blair, notes that its exclusive Costco cost card is among the first widely adopted “contactless” cards in the U.S. Analysts expect earnings to grow 17% and the stock to rise more than 15% next year.

American Express and Discover can seem downright stodgy by comparison. They concentrate primarily on issuing cards, which ties their profitability more closely to consumer spending habits. American Express axp took a big revenue hit when it lost the Costco franchise to Visa—one reason its stock is down about 30% from its 2014 highs. That said, AmEx’s unusually affluent customers and its near lock on the corporate expense-account business should stop its recent slide.

For more on credit cards, watch this Fortune video:


Its customers spend two to three times as much per account as the average card user, which makes them desirable to merchants—enabling AmEx to charge higher-than-average transaction fees. AmEx has reassured investors by ramping up its rewards programs to keep such gold-mine customers from defecting. It’s no longer a stock to avoid, but analysts don’t expect robust growth anytime soon.

The biggest bargain among the Big Four may be the one with the most traditional business model. Discover Financial Services dfs focuses almost exclusively on credit cards and lending. It has rigorously avoided risky borrowers: “They stayed in the ‘superprime’ space even before the financial crisis,” says Sanjay Sakhrani, managing director at investment bank Keefe Bruyette & Woods. Its stock trades at 9.5 times 2017 earnings, inexpensive relative to its credit card rivals and to banks in general. And because lending is its main business, Discover’s profit margins should improve if interest rates rise. Sakhrani and other analysts think the stock could climb from the mid-50s to around $65 next year—the kind of gain that could fund a future shopping spree for today’s investors.

A version of this article appears in the December 1, 2016 issue of Fortune with the headline “Play Your Cards Right.”