On Wednesday morning, General Motors (GM -0.04%) reported yet another strong quarterly profit, despite significant headwinds from the global semiconductor shortage and a couple of recent warranty recalls. The top U.S. automaker raised its full-year guidance, too.

Investors weren't impressed, though. GM stock plunged 9% following the earnings report on Wednesday, continuing a share-price pullback that began in June.

GM Chart

General Motors stock performance, data by YCharts.

It's true that some aspects of GM's Q2 financial performance may have missed investors' expectations. Nevertheless, the recent drop in GM stock represents an excellent buying opportunity based on the company's strong near-term and long-term market position.

Another good quarter

General Motors delivered a huge earnings beat in the first quarter, highlighted by its adjusted operating income of $4.4 billion. However, at the time of its Q1 earnings report in early May, it projected that second-quarter performance would be much weaker -- largely due to the semiconductor shortage -- bringing total adjusted operating income for the first half of 2021 to around $5.5 billion.

In June, GM raised its first-half forecast dramatically, mainly thanks to its efforts to mitigate the chip shortage's impact. On June 16, the company said it expected to generate a first-half adjusted operating profit between $8.5 billion and $9.5 billion.

This week, the General reported second-quarter adjusted operating income of $4.1 billion. That brought its first-half adjusted operating profit to $8.5 billion, just reaching the low end of its updated guidance range. Analysts had been expecting more, and this likely explains GM stock's weak performance on Wednesday.

A black Chevy Silverado driving on a road, with a blurred green field in the background.

Image source: General Motors.

Yet General Motors' results were quite strong by historical standards. The company continues to earn double-digit margins in North America, while the used-vehicle shortage is helping its finance segment generate massive profits. Moreover, GM's adjusted earnings per share of $1.97 dramatically exceeded what analysts had been projecting prior to the auto-giant's guidance updates.

Warranty costs made the difference

GM disclosed that recall-related costs reduced its Q2 adjusted operating income by $1.3 billion. The bulk of these costs (over $800 million) related to the recent recall of Chevy Bolt EVs (electric vehicles) built for the 2017 to 2019 model years due to a rare manufacturing defect that increases the risk of the batteries catching fire. The fix -- which involves replacing the battery modules -- will cost over $10,000 per vehicle, explaining the big recall charge.

GM also recently issued a recall for hundreds of thousands of pickups. Like the Bolt recall, this occurred after GM issued its updated forecast in mid-June. Excluding the $1.2 billion of warranty costs associated with these recalls, the company would have exceeded the high end of its updated guidance range.

A light blue Chevy Bolt driving on a road.

A pricey recall of older Chevy Bolts dented GM's Q2 profit. Image source: General Motors.

Full-year guidance rises

Despite the impact of these recalls on Q2 earnings and the ongoing headwind from the chip shortage, GM raised its full-year outlook on Wednesday. The automaker now expects to generate adjusted operating income of $11.5 billion to $13.5 billion this year, up from its prior forecast of $10 billion to $11 billion.

GM also boosted its earnings-per-share (EPS) guidance range to $5.40-$6.40 from a prior range of $4.50-$5.25. There's a lot of uncertainty baked into this forecast, as the chip shortage is making it hard for automakers to estimate their production potential. But even the low end of the new range would represent a solid result in the current environment -- and GM stock trades for less than 10 times that projected EPS figure.

Great short-term and long-term prospects

Last quarter, GM delivered over 688,000 vehicles in the U.S. That was down just 8% from Q2 2019, even though the General ended last quarter with just 212,000 units in U.S. dealer inventories, compared to 809,000 two years earlier. Moreover, full-size pickup sales increased by more than 20% over that period.

This highlights the strength of demand for GM's current products. As the semiconductor shortage eases over the next year or so, General Motors will likely ramp up output quickly to meet pent-up demand. That, in turn, could drive a huge jump in earnings next year.

Looking further ahead, GM is investing aggressively in its Ultium battery platform, which will allow it to launch a slew of new electric vehicles while rapidly reducing battery costs. It also continues to invest in other promising long-term growth opportunities like hydrogen fuel cells and autonomous vehicles. These moves should help the auto giant generate durable and growing profits, creating tremendous upside in GM stock for long-term investors.