Telecom giant T-Mobile US (TMUS -0.06%) has seen its stock price rise over recent months. Shares hit a 52-week high of $165.95 on Jan. 19, and remain near that high at the time of this writing.

It's no wonder T-Mobile stock is up this year. The telecom finished 2023 with excellent earnings results for the fourth quarter. Given the company's success, does it make sense to buy shares even though the stock is near its 52-week high?

To answer that question, it's necessary to dig into T-Mobile's performance in more detail. This can help to determine if the company is a good long-term investment.

T-Mobile's key to success

T-Mobile's 2023 success was driven by its new 5G network. This network not only delivers faster wireless speeds, it's also able to handle more devices using it simultaneously. Such capabilities are important in a world where even cars are now accessing wireless networks.

Telecom companies have touted the benefits of 5G for years as they were building out infrastructure to support the technology. Now, T-Mobile's 5G network covers 98% of Americans.

This expansive wireless coverage was a necessary first step to convince customers to adopt the more expensive 5G plans. Without broad coverage, your wireless device is limited in the locations where it can take advantage of 5G's capabilities.

With the necessary coverage now in place, T-Mobile is well-positioned to fully unlock the value of its 5G network. In this regard, the company is succeeding.

Take, for example, T-Mobile's impressive ability to attract customers. In Q4, the company added a whopping 934,000 postpaid phone subscribers, the telecom industry's most valuable customer segment. Contrast this to rivals AT&T and Verizon Communications which had 526,000 and 449,000 postpaid phone net additions, respectively.

But wireless subscribers aren't the only way T-Mobile is generating revenue from its 5G network. Thanks to 5G's ability to support multiple devices with speed, T-Mobile can offer internet service to homes and businesses. So now the company is competing with traditional internet service providers (ISPs) such as Charter Communications.

On this front, 2023 turned out to be T-Mobile's biggest year of growth as an ISP. The company added over 2 million customers last year. This brings T-Mobile's total subscriber base to 4.8 million customers for its internet offerings.

That 2023 growth rate is impressive. If T-Mobile can continue to nearly double its ISP clients every year, in just a few years, it could rival Charter, which has 32 million customers.

T-Mobile's financial accomplishments

The customer growth across T-Mobile's services translated into Q4 sales of $20.5 billion. Wireless service revenue from postpaid subscribers contributed $12.5 billion to that total, representing a 6.4% year-over-year increase.

Its success in growing postpaid subscriber sales also helped T-Mobile generate strong free cash flow (FCF). FCF is an important metric, since it provides insight into a company's cash available for activities such as investing in its business, paying down debt, and funding a dividend.

T-Mobile achieved adjusted FCF of $4.3 billion in Q4, up 97% from 2022's $2.2 billion as costs related to its 2020 merger with Sprint declined nearly 80% from the prior year. Its FCF results are more important than ever for investors because the company implemented a dividend toward the end of 2023.

T-Mobile expects to pay about $3 billion in dividends this year. It can easily afford it after closing out 2023 with full-year FCF of $13.6 billion. In fact, T-Mobile is targeting even higher FCF in 2024, forecasting to reach at least $16.3 billion.

To buy or not to buy T-Mobile shares?

T-Mobile's 2023 success looks like it will extend into this year. In its 2024 outlook, the company not only believes it will continue to grow its customer base, but T-Mobile stated it's expecting "to lead the industry for the 10th consecutive year" in net additions to its postpaid subscribers.

Given the telecom titan's success, the average price target for T-Mobile stock among Wall Street analysts is $185.67. So there's a consensus of further upside for T-Mobile shares.

When you combine T-Mobile's expansive 5G network, subscriber growth, and excellent FCF generation, and throw in a dividend, it adds up to the telecom titan being a worthwhile investment to buy and hold for the long term.

Although shares are near a 52-week high, since Wall Street believes the stock can go higher and you may not want to miss that potential upswing, a good approach to buying T-Mobile stock is to use dollar-cost averaging. You can buy some shares now, then add to your position during future stock price drops.