From a financial perspective, the new post-bailout General Motors (NYSE:GM) has been a resounding success. The company is on pace to produce an operating profit of more than $10 billion for a third consecutive year, something that would have been unthinkable a decade ago.

Nevertheless, General Motors stock has spent much of the past six years trading below its IPO price of $33.

GM Chart

General Motors Stock Performance. Data by YCharts.

However, General Motors stock has been on a tear recently. It finally broke through the $40 level following an analyst upgrade earlier this week, reaching a new multiyear high. (GM stock also traded above $40 for a brief period in late 2013 and early 2014.) This makes it a good time to evaluate the stock's future prospects.

The case against GM

While General Motors has produced fantastic results recently, there are some legitimate reasons to worry about the sustainability of its earnings. Historically, auto sales have been quite cyclical, and the U.S. auto cycle appears to have peaked last year. If U.S. auto sales continue to decline for the next several years, it could have a significant impact on GM's profitability because of the high fixed costs associated with auto manufacturing.

To make matters worse, General Motors has been dealing with an inventory glut for most of the past year. (As of the end of August, it had 88 days of sales in inventory, whereas 60-70 days supply is considered healthy.) This raises the risk that GM would need to offer big discounts to clear out unwanted vehicles.

Longer term, rising regulatory costs and increasing competition from electric vehicle pure plays like Tesla could further undermine GM's profitability. General Motors stock may look cheap based on its P/E ratio, but that' s not very meaningful if its earnings will soon fall off a cliff.

The General could buck the industry trend

Fortunately for GM investors, the company is well positioned to outperform competitors like Ford Motor (NYSE:F) in a down market. For example, General Motors has been investing heavily in product development, so it will have one of the newest product portfolios in the industry for the next few years, particularly in the lucrative truck, SUV, and crossover markets.

A Chevy Equinox crossover on a winding road

GM is rapidly updating its lineup of trucks, SUVs, and crossovers. Image source: General Motors.

During 2016, GM launched a redesigned GMC Acadia crossover. The new Chevy Equinox hit dealer lots earlier this year, and updated versions of the Chevy Traverse and GMC Terrain are starting to become available as well. More new crossover models are on track to arrive in 2018 and 2019, particularly for the upscale Cadillac brand.

By contrast, Ford Motor only builds a few high-volume crossovers and SUVs, led by the Escape and Explorer models. This has left Ford at a big disadvantage in the fastest-growing segment of the market.

The one area where Ford is outperforming GM right now is the full-size truck market. Ford has posted 9% sales growth for its F-Series trucks year to date, compared to a 5% decline for GM's full-size truck lineup. This reflects the fact that Ford has newer products in that segment. However, new versions of the Chevy Silverado and GMC Sierra will hit the market next year, which should help GM regain share in this high-margin segment in late 2018 and 2019.

It's not too late to buy General Motors stock

Excitement about GM's work in emerging areas like autonomous driving and electric vehicles has driven much of the recent rally in General Motors stock. These initiatives are important for ensuring the company's long-term competitiveness.

Meanwhile, GM's core business remains underappreciated by most investors. Its heavy investments in new products should pay off in a big way over the next few years, even if total auto industry sales continue to decline.

Even after its recent rally, General Motors stock trades for less than seven times earnings. The company is taking advantage of this low valuation through an active share repurchase program. In fact, GM plans to spend about $3.5 billion on buybacks in the second half of 2017, which would reduce its share count by about 6%. It also pays a generous dividend that yields nearly 4%.

In short, GM has plenty of upside -- and investors have a great incentive to be patient. It's still not too late to buy General Motors stock.

Adam Levine-Weinberg owns shares of General Motors. The Motley Fool owns shares of and recommends Ford and Tesla. The Motley Fool has a disclosure policy.