The stock market is off to a decent start in 2023, with the S&P 500 up by about 4% with about a week left in January -- not a stellar performance but a welcome change from last year. However, some of the hardest-hit stocks in 2022 are rebounding very strongly.

Here are three stocks that have already gained more than 25% this year. And despite the gains, all three could still be excellent long-term investments.

1. Block (Square) -- Up 29%

Block (SQ -3.40%), formerly known as Square, dramatically underperformed the market in 2022, for a few reasons. For one thing, its business is largely dependent on consumer spending, and with a recession looming, growth could become difficult. There are also credit risk fears surrounding the (expensive) Afterpay acquisition, as well as the cooling off in Bitcoin prices, both significant revenue drivers for Cash App.

However, this is still a powerhouse fintech disruptor with lots of room to grow its ecosystem. On the Square (business) side, the company processes more than $200 billion in annualized volume, and over 49 million people actively use the Cash App. As more features are added to the platforms, they'll become even stickier over time. With an estimated $185 trillion in payments volume worldwide, the company could be just getting started.

2. Ally Financial -- Up 28%

Unlike the other stocks on this list, most of Ally Financial's (ALLY -2.92%) recent move higher took place in a single day. The auto lending-focused bank reported earnings recently. It handily beat expectations on both the top and bottom lines, and loan losses weren't nearly as high as many had feared.

Ally has an extremely profitable business model that is overlooked by many investors due to fears about consumers falling behind on their auto loans. In the fourth quarter, Ally's average new auto loan had a 9.57% yield and its average cost of funds in 2022 was just 1.71% (mostly consumer deposits). Its net interest margin is one of the highest in the banking business, while a 12% discount to its book value makes Ally stock a promising long-term investment.

3. Redfin -- Up 46%

The most speculative stock on this list, Redfin (RDFN -3.85%) has been so volatile that even after rallying 46% this year, it is still down by nearly 95% from its 2021 peak. Not only has the real estate market ground to a virtual halt, but the company made some expensive acquisitions right before the market cooled and it has been losing money hand over fist.

However, Redfin is doing a great job of bringing costs under control and focusing on its core businesses. We're already starting to see signs of life in the real estate market, as mortgage rates are about 1 percentage point below the peak. If the market normalizes, Redfin could be a big winner.

Expect a roller-coaster ride

To be clear, I like (and own) all of these stocks because I think they are excellent companies with strong leadership and will be long-term winners -- not because I think they're going to rocket higher in 2023. In fact, it's important to know that any stock that can rise 25% or more in three weeks can move just as sharply in the other direction if market conditions deteriorate.

If you're a long-term investor with the stomach to handle volatility, all three of these still look like excellent long-term investments at these prices, even after the recent gains. But make sure you're prepared for a bit of turbulence on the way.