It hasn't been the best few years for AT&T (T 0.33%), with the stock down close to 30% over the past five years, but brighter days seem to be ahead. After what can only be explained as an all-but-failed attempt at entering the media and entertainment industry, AT&T finally spun off its WarnerMedia business last year. And investors seem pleased, with the stock up over 9% in the past 12 months.

The $43 billion spinoff caused AT&T to slice its dividend in half, yet it's still one of the better dividend values at $1.11 per share. With a trailing dividend yield -- the average dividend yield over the past 12 months -- of over 5.7%, there's little to dislike about it.

The key is sustainability. As AT&T shifts its focus back to its core telecommunications (telecom) business, I believe it's positioned to be a great long-term dividend stock regardless of market conditions.

Telecom is essentially a consumer staple

The products and services that customers buy fall into two categories: consumer staples and consumer discretionary. Simply put, consumer staples are products and services that are needs, and consumer discretionary products and services are wants. Telecom services are essentially a need in American life.

From phone service to the internet to broadcasting to broadband to satellites, both people and businesses need telecom services to operate daily in the U.S. For consumers, when money is tight or economic conditions are bad, there's likely a long list of expenses someone would cut before even considering not having phone service. And running a business would be virtually impossible today without internet access.

An indispensable product or service is as good for longevity as any other business metric.

Trimming down the business and debt

AT&T's WarnerMedia spinoff was much needed as the company was beginning to spread itself too thin and take on too much debt. Almost a year after that spinoff was announced, it's been recently reported that AT&T is now trying to sell its cybersecurity division, another move the company is taking to trim down and refocus on its core telecom business.

The cybersecurity division, originally called Alienvault, was acquired in 2018 for roughly $600 million. It's not guaranteed that a sale will happen -- or how much it'll be for if it does -- but it should be a positive sign for long-term investors. AT&T's recent divestments helped the company pay down its once-massive debt.

AT&T has about 83% more long-term debt right now than a decade ago, but reduced it by around $22.5 billion last year. At the end of 2022, the debt was around $132.2 billion, but the company says it plans to reduce it to around $100 billion by 2025.

T Total Long Term Debt (Quarterly) Chart

Data by YCharts

As AT&T continues to trim its business and cut costs to pay down debt, long-term investors should feel assured that the company can keep its lucrative dividend rolling.

Customers are flocking in

In its fourth quarter of 2022, AT&T added 656,000 new postpaid phone customers. That capped an impressive year that saw the company add close to 2.9 million new postpaid phone customers. It's a bit lower than the 884,000 and 3.2 million, respectively, that it added the previous year, but it's still a good feat, especially considering Verizon Communications only had 217,000 postpaid phone adds in its Q4.

AT&T fiber is also growing at an impressive pace, adding 280,000 customers in Q4 and 1.2 million for the year.

As AT&T is able to shift resources back to its core telecom business and attract customers to its consumer staple services (like phones and internet) instead of ventures like entertainment, the company building a good foundation that should drive future growth and revenue generation.