Telecom giant AT&T (T 0.74%) surprised investors on Thursday with third-quarter results that sent its stock flying. Not only did AT&T beat analyst expectations for both revenue and earnings per share, but the company gained more postpaid phone subscribers than it did in the previous quarter and raised its full-year free-cash-flow outlook.

AT&T stock has been stuck in the doldrums this year as investors fretted about the company's high level of debt, a more competitive wireless industry, and the possibility that AT&T would fall short of its free-cash-flow target. The company has now put at least some of those concerns to bed.

Firing on all cylinders

AT&T's mobility revenue grew 2% year over year, driven by a 3.7% rise in service revenue and held back by a 3.2% drop in equipment revenue. The company gained 468,000 net postpaid phone subscribers, up from a gain of 326,000 in the second quarter.

Postpaid churn held steady at 0.95%, an indication that AT&T is having little trouble keeping customers. Average postpaid phone revenue per user was up 0.6%, thanks to higher prices and a mix shift toward unlimited plans.

AT&T's fiber business is also thriving. The company added 296,000 net fiber subscribers, bringing the total to 8 million. Fiber revenue grew 27% year over year to $1.6 billion, driven by subscriber gains and an 8.9% rise in consumer fiber average revenue per customer. AT&T also recently rolled out its 5G-powered Internet Air fixed wireless service, which should help it reach customers not served by its expansive fiber network.

The company has long maintained its full-year free-cash-flow guidance of at least $16 billion, but the strong third-quarter results prompted the company to boost its outlook. AT&T now expects to generate around $16.5 billion in free cash flow this year. Through the first three quarters of the year, the company is $2.4 billion ahead of where it was at the same point last year.

Cost-cutting is helping the cause. AT&T is in the early stages of reducing costs by at least $2 billion and plans to hit that target within the next three years.

A solid value

Based on its new free-cash-flow guidance and accounting for the post-earnings surge in the stock price, AT&T stock now trades at a price-to-free-cash-flow ratio of about 6.6. That's about where this valuation metric sat before the earnings report, but investors should now be more optimistic about AT&T's ability to sustain its free-cash-flow generation.

The company's dividend is still attractive, as well, with the stock sporting a dividend yield of about 7.2%. That's down from recent highs but still more than quadruple the yield of the S&P 500. Meaningful dividend increases are unlikely as the company works to reduce its debt over the next couple of years.

While AT&T's core wireless segment may slow back down if economic conditions deteriorate from here, the company's third-quarter results should help convince investors that its business is resilient. There are still some wild cards in play -- notably, unknown legal and financial exposure to lead telecom cables and the potential sale of its remaining stake in DirecTV next year.

Even with some unknowns for AT&T over the next few years, a wildly pessimistic valuation, a sky-high dividend yield, and strong performance in a tough wireless market are all good reasons to buy AT&T stock.