2022 delivered an obstacle course of scenarios for major automakers to drive through, including semiconductor chip shortages and rising interest rates, among other factors. But you wouldn't know it from looking at General Motors' (GM 0.27%) fourth-quarter results. The Detroit automaker is practically printing money right now.

Here's a quick look at what's behind the better-than-expected earnings and why GM might be the best auto stock to buy.

Topping estimates

General Motors reported a strong fourth quarter with earnings per share of $2.12, well ahead of Wall Street estimates of $1.69. It generated $3.8 billion in earnings before interest and taxes (EBIT) from $43.1 billion in sales, which also easily topped estimates of $3.2 billion and $40 billion, respectively.

For the full year, GM posted a record $14.5 billion (EBIT adjusted) on revenue of $156.7 billion. Also impressive was adjusted automotive free cash flow of $10.5 billion, compared to the prior year's $2.6 billion.

With such a bumpy road for automakers in 2022, what drove GM's better-than-expected results?

Big vehicles bring in big profits

Sure, automakers generally wants to sell more vehicles year to year, but more importantly they want to sell more-profitable vehicles. Across the automotive industry, full-size trucks and large SUVs currently haul a larger share of the profits, and that's good news for GM because its larger-vehicle portfolio is doing great.

GM was the U.S. market leader in total sales, full-size pickup truck sales, full-size and large luxury SUVs, and luxury sports cars -- all highly profitable segments. In 2022, GM sold more than 1.1 million full-size pickups, midsize pickups, and full-size SUVs, which is over 350,000 more than the second closest competitor.

Further, the automaker's GMC brand was the No. 1 premium truck brand in 2022, and 46% of retail sales were in big-ticket Denali or AT4 trims, helping boost profitability. Big vehicles should continue to generate big profits in the industry in the near term, but GM is also working on its plan for a future with electric vehicles (EVs) and autonomous driving vehicles.

The road ahead

The main factor that makes GM an excellent automotive stock to buy now is that the company was able to navigate difficult waters in 2022 well and at the same time advance its plans. GM is entering the second phase of its EV strategy and will offer nine models in 2023 that strategically hit popular vehicle segments at multiple price points.

During the first half of the year, investors can expect the Chevrolet Silverado EV and the GMC Hummer EV SUV to hit the roads. In the second half, the automaker will roll out the Chevrolet Blazer EV and Equinox EV. Late 2023 will bring the Corvette E-Ray, the first electrified all-wheel-drive Corvette. As production ramps up and EV sales continue to grow, GM expects up to mid-single-digit margins on its EV lineup by 2025 and for EVs to generate $50 billion of its total $225 billion estimated revenue in 2025.

GM's EV strategy goes well beyond launching models. The automaker invested $650 million jointly with Lithium Americas to develop the largest known supply of lithium in the U.S. and expects it will support production of up to 1 million EVs per year. The investment will help it secure its supply chain and better manage battery cell costs.

Beyond EVs

GM's growth drivers include other areas as well. Investors often overlook its BrightDrop business, which offers electric products and services to businesses that deliver products to last-mile consumers. The Detroit automaker estimates BrightDrop will generate $1 billion in revenue in 2023.

And let's not forget Cruise, GM's autonomous driving entity, which has recently expanded beyond San Francisco into Phoenix and Austin and is nearing 1 million fully driverless miles across roughly 300 all-electric autonomous vehicles.

GM finds itself in a great position. It has done well in a difficult year in the automotive industry, raking in profits thanks to its successful portfolio of larger SUVs and trucks, while preparing a slate of EV launches for 2023. It has diversified its revenue streams with businesses like BrightDrop and continues to build for the future of driverless vehicles.

GM is a forward-thinking company with a secure supply chain, stable of highly profitable vehicles, and a clear vision for the future. It may be one of the best automakers to invest in and still be able to sleep soundly at night.