It's been a tough year for automotive lender and online banking specialist Ally Financial (ALLY -0.15%). Rising interest rates continue to squeeze its margins and now credit concerns in a weakening economy are adding to its financial pressures.

With the stock down 44% this year, buying Ally Financial shares may not look like a smart decision. But if you refocus the lens to take a wider view, buying this stock today could actually be a clever move. Here's why.

Short-term problems

Ally Financial recently released its third-quarter earnings, and the results fell short on all fronts. To start, high interest rates are shrinking its net interest margin (NIM), the spread it earns  on the difference between the interest it earns on its loans and the interest rate it pays to depositors. Its NIM narrowed by 0.23 percentage point in the third quarter and the company expects a further squeeze of 0.30 point by 2023.

NIM compression is less than ideal, but it's something many bank stocks are facing today. The bigger concern is the number of net charge-offs it's experiencing for its auto loans. Q3 2022 saw an 80% jump in the value of auto loans that are unlikely to be collected. This exceeds pre-pandemic levels from Q3 2019, and worsening credit conditions for its borrowers could mean more delinquencies and charge-offs in the future. 

Looking at the bigger picture

It's certainly disappointing to see such lackluster earnings, but investors should remember the challenges Ally is facing are temporary. While the U.S. isn't officially in a recession, two quarters of negative gross domestic product growth in the first half of 2022 and higher loan losses are sure signs of significant economic weakness.

Economic slowdowns are hard on banks. Higher unemployment rates mean people have to spend their savings, which draws down deposits. Banking institutions rely on deposits to make new loans, so less money in the bank trends to constrain the ability to fund new loans. Economic softness also tends to result in higher defaults on credit card, car, and home loans -- something the company is already seeing.

It's not all bad news, though. Ally Financial has several things going for it to help it overcome today's challenging circumstances. The first is that it boosted its reserve to $3.6 billion to help it combat future loan losses. The second is that online banking is picking up momentum as well and has low overhead thanks to having no physical branch offices.

Also, Ally's consumer banking business is booming. Retail deposits rose by $2.7 billion from Q2 and retail spending is still exceeding pre-pandemic levels. Higher interest rates will help increase the yield on retail auto loans, which the bank expects to rise to the mid-8% range by the fourth quarter of 2023.

Challenging economic times don't last forever. A lot of banks were crushed in the Great Recession. But financial conditions are different today and banks like Ally Financial are in a much better position to weather the storm. The company's offensive moves to increase its reserves in light of what could be coming means it's taking the near-term problems seriously and is preparing to succeed over the long term.

Ally's stock is trading well below its book value, and at about 4.5 times its per-share earnings, making today's valuation a great entry point for long-term investors.