Shares of e-commerce and payments platform Shopify (SHOP 0.28%) surged on Thursday, following the company's third-quarter earnings report. Revenue for the quarter beat expectations, rising 25% year over year to more than $1.7 billion. Analysts, on average, were expecting revenue of $1.67 billion. Though this was good news, the great news was the company's improving profitability. Earnings per share swung from a loss of $0.12 in the year-ago period to $0.55. Additionally, the company generated heaps of free cash flow during the quarter, adding to its already large war chest of cash and cash equivalents.

The financial performance was a reminder that not all growth stocks are created equal. Some have the potential to become great cash generators. Even better, Shopify has already become one.

Heaps of cash

One year ago, Shopify president Harley Finkelstein told investors in its 2022 third-quarter earnings call that Shopify will "get back" to profitability. Today, Shopify has more than delivered. The company generated third-quarter operating income of $122 million, up from an operating loss of $346 million in the year-ago quarter. Further, Shopify's free cash flow (cash flow from operating activities less capital expenditures) came in at 16% of the quarter's $1.7 billion of revenue -- up from a negative free cash flow margin of 11% in the year-ago period.

The tech company is making a habit of generating positive cash flow. Not only was this the company's fourth quarter in a row of positive free cash flow but its free cash flow margin is expanding. Shopify's free cash flow margin for the first half of the year was 6%.

This impressive cash flow is bolstering Shopify's already impressive pile of cash. The company wrapped up its third quarter with $4.9 billion of cash and marketable securities. Subtracting its outstanding convertible notes, its net cash position is $4.0 billion.

Disciplined growth

Fortunately for Shopify shareholders, these are likely still early days when it comes to the company's growth prospects and its improving profitability. It plans to maintain its appetite for growing profits while prudently investing in its biggest growth opportunities. In other words, Shopify thinks it can achieve both rapid revenue growth and substantial earnings growth simultaneously in the coming years.

After pointing to its 16% free cash flow margin, Shopify chief financial officer Jeff Hoffmeister said in the company's third-quarter earnings release that the e-commerce specialist "will continue to operate with discipline, thoughtfully investing in the huge opportunities ahead across regions, products, and channels to help merchants capture every opportunity every step of the way."

Specifically, management said in its third-quarter update that it expects full-year revenue to increase at a rate in the mid-twenties on a year-over-year basis, with fourth-quarter free cash flow as a percentage of revenue once again coming in in the high teens.

"Free cash flow margin and free cash flow dollars have both improved every quarter this year," management explained in the company's third-quarter earnings release, "and Q4 will continue to deliver on this upwards trend -- a clear manifestation of the steps that we have taken this year to drive toward greater profitability, as we build for the long term."

Combining its rapid top-line growth, large growth opportunities, and disciplined approach to expenditures and investments, this cash-generating machine is still in its early innings.