General Motors (GM -0.04%) has faced huge challenges over the past three years. In late 2019, a six-week UAW strike made a significant dent in the General's production, revenue, earnings, and cash flow. In 2020, factory closures related to the COVID-19 pandemic had an even greater impact on those metrics. Last year, the global semiconductor shortage had a similar effect.

Nevertheless, GM managed to post record earnings and solidly positive free cash flow in 2021. The company is on track for an even better all-around performance in 2022. Moreover, it has strong long-term growth potential thanks to its aggressive investments in electric vehicles (EVs) and autonomous vehicles (AVs).

Another earnings beat

In the fourth quarter, General Motors generated an adjusted operating profit of $2.8 billion and adjusted earnings per share (EPS) of $1.35. This comfortably beat the Wall Street analyst consensus of $1.19. It also beat the company's guidance, which had already been increased once during the quarter.

For the full year, GM reported an adjusted operating profit of $14.3 billion and adjusted EPS of $7.07: both all-time records.

A dark colored Chevy Silverado pickup driving on a rural road.

Image source: General Motors.

GM's earnings performance was particularly remarkable because the company delivered just 2.3 million vehicles in its core North American market during 2021 (due to the chip shortage). In 2017 and 2018 -- the last two years that it didn't face major production constraints -- the automaker delivered over 3.5 million vehicles in North America. As supply constraints ease and production recovers, it will unlock a substantial amount of incremental revenue and profit.

Expecting another great year

Fortunately, semiconductor supplies are already improving for GM. As a result, management expects wholesale deliveries to surge 25% to 30% year over year in 2022. That will drive a big increase in revenue.

Despite higher projected revenue, GM's guidance calls for adjusted operating income between $13 billion and $15 billion and adjusted EPS of $6.25 to $7.25 this year. The midpoints of those ranges are modestly below the company's 2021 performance.

However, this outlook incorporates over $2 billion of incremental spending on growth initiatives. That includes software development and engineering costs for new EV models, investments in ancillary businesses, and expenses related to launching a robotaxi service at Cruise (GM's AV subsidiary). Furthermore, the company's projections may prove to be conservative: Under CEO Mary Barra, GM has built an impressive track record of beating its forecasts.

Cash flow recovery on the way

One financial metric continued to lag for General Motors in 2021: free cash flow. Full-year adjusted automotive free cash flow totaled $2.6 billion: in line with 2020. Over the past three years combined, GM has recorded over $32 billion of adjusted operating profit but generated only $6.3 billion of adjusted automotive free cash flow.

A red Chevy Blazer parked on a beach.

Image source: General Motors.

Interest costs, tax payments, and investments in growth initiatives account for some of this disparity. However, the main thing weighing on the General's cash flow since 2019 has been a cumulative working capital headwind of over $14 billion due to falling dealer inventories related to GM's production constraints.

GM began to rebuild dealer inventories last quarter (albeit slowly), driving a sharp turnaround in free cash flow. That trend is set to continue in 2022. Management estimates that adjusted automotive free cash flow will rebound to between $7 billion and $9 billion this year, despite a big increase in capital spending. Free cash flow could rise again in 2023 as production constraints ease further.

Outstanding long-term prospects

Looking beyond the next year or two, General Motors is poised to cash in on its early investments in EVs and AVs. Cruise recently began offering limited robotaxi service to the public and needs just one more permit to begin charging for rides in its home market of San Francisco. Meanwhile, GM is rapidly adding battery and EV manufacturing capacity and plans to launch numerous new EV models over the next few years.

Last fall, GM projected that it could double revenue to between $275 billion and $315 billion by 2030 while expanding its profit margin. While there's no guarantee it will get there, these targets appear achievable. They assume fairly modest growth in the core auto business, complemented by sizable new revenue streams from Cruise's robotaxis, connected services, and other new lines of business.

Despite this growth potential, GM shares trade for just 7.5 times earnings. At that rock-bottom valuation, the stock has massive upside even if the company falls short of some of its targets over the next eight years.