Since the EU referendum on 23 June, Lloyds (LSE: LLOY) has fallen by 22%. Clearly, that’s disappointing but that statistic doesn’t paint the full picture. That’s because Lloyds has begun to make a recovery of sorts over the last month, with its shares up by 5% during the period. Although further gains are difficult to call in the short run, Lloyds could prove to be an excellent long-term buy.

A key reason for this is its valuation. Lloyds now trades on a price-to-earnings (P/E) ratio of just 7.5, which is lower than the P/E ratios of sector peers such as Barclays and RBS that have P/E ratios of 13.3 and 18.3 respectively. This indicates that Lloyds is undervalued relative to the wider banking industry, as well as being cheap on an absolute basis.

As a result, its shares offer a major upward rerating opportunity as well as a wide margin of safety. This reduces Lloyds’ risk profile and means that the dangers facing the UK economy may be more than adequately priced-in.

For example, the Bank of England now estimates that the UK economy will grow by just 0.8% next year, which is down from its previous forecast of 2.3%. In fact, that revision to the Bank of England’s forecast is the biggest fall in guidance since 1992 and shows just how difficult the outlook for the UK economy is. Unemployment is expected to rise to 5.5% from the current 5% level, while house price falls seem almost inevitable.

UK focus

Lloyds clearly has a major UK focus following its acquisition of HBOS in the last recession and it would be unsurprising for its profitability to come under pressure in the medium term. However, Lloyds has become a very efficient and financially sound bank since the credit crunch. Asset disposals, major redundancies and a more resilient balance sheet means that it’s in a strong position to face the challenges ahead. In fact, the recent EU-wide stress tests showed that Lloyds is better equipped to cope with a downturn than the likes of Barclays and RBS, and yet they trade on much higher valuations.

Although Lloyds’ dividend outlook is now much more uncertain than it was a few months ago due to Brexit, it’s still forecast to yield 6.2% in the current year. This puts it towards the top of the income pile in the FTSE 100 and with dividends being covered 2.1 times by profit, they appear to be sustainable at their current level unless Lloyds endures a huge fall in profitability.

Of course, this can’t be ruled out and the UK economy may endure a full-blown recession over the next few years. However, Lloyds has a very low valuation, a sound balance sheet and could prove to be a star buy for long-term investors.

Are you prepared for Brexit?

Following the EU referendum, fear and indecision could hurt share prices in the coming months. That's why the analysts at The Motley Fool have written a free and without obligation guide called Brexit: Your 5-Step Investor's Survival Guide.

It's a simple and straightforward guide that could make a real difference to your portfolio returns. In fact, Brexit could even prove to be a positive catalyst on your portfolio performance.

Click here to get your copy of the guide - it's completely free and comes without any obligation.

Peter Stephens owns shares of Lloyds Banking Group. The Motley Fool UK has no position in any of the shares mentioned. We Fools don't all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors.