International Business Machines (IBM -1.95%) has emerged as one of the few winners in big tech this year. The stock has surged nearly 7% year to date, compared to a 16% decline for the S&P 500 and much steeper declines for many tech stocks.

It's never a good idea to buy a stock solely because its price is rising, but IBM has a lot more going for it than a buoyant stock price. Here are three reasons to invest in this iconic century-old tech company.

1. An enterprise focus

IBM serves large companies and organizations. Some of those client relationships span decades, involving myriad products and services that are deeply embedded in day-to-day operations. A company running on IBM mainframes, like 45 of the top 50 banks, are going to continue to run on IBM mainframes for the foreseeable future.

IBM's cloud services are also pervasive in the largest of organizations. IBM Cloud is used at 94% of Fortune 50 companies, and Red Hat products and solutions are found at more than 94% of Fortune 500 companies. IBM's security products are used at two-thirds of Fortune 500 companies, and the top ten companies in financial services, telecom, automotive, healthcare, and public sector are clients of IBM's consulting arm.

Serving enterprise customers won't fully protect IBM from the impacts of a recession, but it can certainly minimize disruptions. Most of IBM's customers aren't going anywhere. They may look for ways to reduce spending, but many of the products and services IBM provides are mission critical. IBM's customer base will serve as a source of stability even in the most tumultuous of economic environments.

2. Cash flow and dividends

IBM has spent the better part of the last decade remaking itself for the cloud computing era. Legacy businesses have been jettisoned, and the company has repositioned itself as the leading provider of hybrid cloud computing solutions for the enterprise. Throughout this transformation, IBM has remained a solid producer of free cash flow.

For 2022, despite the rumblings in the economy, IBM expects to generate around $10 billion of free cash flow. This cash flow fully supports the dividend, which currently yields about 4.6%. At the current rate, IBM will spend just under $6 billion on dividend payments over the next year.

Investors shouldn't expect any significant dividend increases in the near term, at least until IBM boosts its free cash flow and further reduces its debt from the acquisition of Red Hat. IBM expects its cumulative free cash flow for the three-year period ending in 2024 to be $35 billion, so the company is predicting a meaningful increase in free cash flow over the next couple of years.

3. A bargain price

IBM is valued at just under $130 billion. With annual free cash flow of $10 billion, the stock trades at a price-to-free-cash-flow ratio of 13.

If you believe that IBM can grow revenue and free cash flow over time, the stock looks like a bargain. IBM's growth profile today looks a lot better than it did a few years ago. The company completed the spin-off of its managed infrastructure services business last year, which got rid of roughly $19 billion of slow-growing, low-margin revenue. IBM can now marshal its resources toward its best opportunities, which include hybrid cloud computing and artificial intelligence.

A recession may make it more difficult for IBM to hit its multi-year targets, but the company is in a good position to weather the storm. Shares of IBM have been going against the tide this year, but it's not too late to buy the stock.