Last month was a good one for the broad market, but a great one for select stocks. Whereas the S&P 500 advanced another 3.1% in July, a handful of the S&P 500's constituents dished out double-digit gains.

Past performance is no guarantee of future results, of course. In fact, the bigger the gain, the greater the potential profit-taking. The question is, should this worry apply to the S&P 500's hottest stocks in July?

Best of the best

Last month's biggest winners among the S&P 500's names are Zions Bancorp (ZION 1.19%), KeyCorp (KEY 0.62%), and Newell Brands (NWL 12.25%), with gains of 42.4%, 33.2%, and 28.3%, respectively. An honorable mention goes to Comerica stock, which was close to cracking the top three with its July gain if 27.4%.

ZION Chart

ZION data by YCharts

July was a decidedly bullish month for banking stocks, and smaller banks in particular. U.S. Bancorp (USB 0.32%) shares also did especially well last month, even if it wasn't one of the S&P 500's very biggest advancers.

The bullish prompt? Earnings, mostly. Or, perhaps more accurately, what last quarter's earnings reports from smaller banks like U.S. Bank, Comerica, KeyCorp, and Zions mean.

In short, these regional banks seem to be attracting customers who may be wary of larger banks following March's collapse of Silicon Valley Bank and Signature Bank. Comerica's second-quarter earnings of $2.01 per share soundly beat estimates of $1.86. Zion Bancorp's total deposits grew 7% sequentially between the end of Q1 and the end of Q2 (although they fell 6% year over year).

All three banks' loan losses also appear to be relatively well contained compared to bigger banks. This may be a function of their smaller size, in fact, which means they've got a better handle on their current and prospective borrowers' financial situations.

In this same vein, although U.S. Bancorp's second-quarter top and bottom lines both fell short of estimates, the market cheered its plans -- along with its peers' plans -- to shrink its balance sheet (including liabilities) headed into an uncertain economic backdrop.

As for Newell Brands, this parent to familiar brand names Rubbermaid, Elmer's glue, Calphalon cookware, Coleman camping gear, Mr. Coffee, and Sharpie markers (just to name a few) started the month of July out on a positive foot, lifted by bullishness from Canaccord Genuity. Although its second-quarter numbers posted late in the month dialed back its full-year revenue and profit forecast in acknowledgment of slowing demand, the news didn't upend the stock's slow rally. Much like most regional banking stocks at the beginning of last month, Newell shares had been dramatically sold off over the course of the prior several months. There was little to no downside left to price in.

To buy, or not to buy?

And that's the tricky part for interested investors. Were last month's biggest gains mere bounce-backs from overzealous selling? Or is this bullishness an indication that investors are seeing something that simply wasn't evident before July?

For Newell Brands the answer is relatively easy -- the market appears to have presumed the worst for the company since early 2021, starting with the impact of the pandemic and then shifting those worries to the impact of inflation. Although somewhat economically sensitive, its businesses and product lines are more resilient than investors are giving the stock credit for. Even with last month's big gain, there's room for more upside.

As for Zions Bancorp, KeyCorp, and other regional bank stocks that soared in July, things are a little more complicated.

Yes, in retrospect investors probably overreacted to the banking industry's liquidity scare from earlier this year; it was largely confined to a handful of banks making short-sighted decisions with their asset bases.

As Moody's sweeping credit downgrade of several smaller banks earlier this week reminds us, however, the domestic economy's lending market is showing cracks. Although it wasn't one of the names explicitly downgraded, Moody's did caution that the aforementioned U.S. Bancorp is "under review" for a potential downgrade in the foreseeable future, joining Truist and Bank of New York Mellon.

Moody's warning is arguably more proverbial bark than bite. In other words, if you own a small banking name for the long haul, don't sweat it. If you were thinking of stepping into a small banking name on this dip for the long haul, go for it. These stocks are below their average long-term valuations, and that upside will last longer than any lending market headwind will. Ditto for banks' benefit from higher interest rates, which aren't apt to meaningfully fall anytime soon.

Just know that the echoes of Moody's worry could ring for a while, and inspire other analysts to voice similar doubts. That could weigh on these stocks' prices for a few weeks, if not months. Just be prepared for that possibility if you're still bullish on these stocks. It wouldn't be wrong to consider other investment options while the banking industry's dust continues to settle.