During 2017, U.S. automakers such as General Motors (GM -0.17%) and Ford (F 0.66%) have had to contend with stagnating demand in the domestic market. In the first half of the year, U.S. auto sales fell 2.1% year over year.

Despite facing headwinds in its most important region, General Motors continued to increase its adjusted earnings per share (EPS) last quarter. GM's controversial decision to exit the European market was the key factor that enabled the General to keep earnings growing.

General Motors delivers another strong quarter

In the second quarter, General Motors began to reduce its production on a year-over-year basis (a trend that will accelerate in Q3) in order to keep supply in line with demand. In North America -- GM's largest and most profitable region -- vehicle wholesales were down by 110,000 units year over year last quarter.

A pair of Chevy Malibus

GM reduced its wholesale volume in North America last quarter. Image source: General Motors.

On the bright side, the decline in North American wholesales came from less profitable parts of the market: compact and midsize cars and rental vehicles. Furthermore, GM was able to reduce its incentives relative to the first quarter.

Even so, General Motors' adjusted operating profit in North America slid 7% year over year. This still left the carmaker with a very strong $3.5 billion segment profit, though. By contrast, while Ford only had a modest 1% decline in North American vehicle wholesales last quarter, its segment operating profit plunged by nearly 20% to $2.2 billion.

Fortunately, GM was able to improve its financial results in each of its other remaining business segments last quarter. This allowed the General to post adjusted EPS from continuing operations of $1.89 -- up 5.6% year over year -- beating the average analyst estimate by $0.20.

The hidden role of leaving Europe

General Motors is very close to finalizing the sale of its European operations to PSA Group as part of a larger move to exit underperforming markets. Consequently, GM Europe's results are now classified as a part of discontinued operations. This means that GM's financial statements now exclude Europe for both 2016 and 2017 when it comes to results from continuing operations.

An Opel car

GM is close to completing the sale of its European operations. Image source: General Motors.

Removing Europe from the main part of GM's financial statements was the difference between reporting EPS growth and an EPS decline last quarter.

GM Europe finally reached profitability in Q2 2016, posting a $137 million pre-tax profit, before plunging back into loss territory thereafter due to the negative impact of Brexit. Last quarter, GM lost money in Europe, even excluding one-time charges. Had this year-over-year earnings decline been included in continuing operations, General Motors' overall Q2 results would have looked a lot different.

For comparison, Ford Europe -- which has been outperforming GM Europe recently -- posted a $379 million year-over-year operating profit decline last quarter.

More upside from downsizing

While GM is staying in emerging markets where it feels it has a competitive advantage, such as South America, it is aggressively downsizing and exiting less promising markets. GM is ending (or has already ended) local manufacturing in Australia and much of Southeast Asia, while it is pulling out of Europe, Africa, and India for the most part.

All of these regions have been losing money and burning cash for years. Exiting them will drive significant profit and cash flow tailwinds for General Motors in the second half of 2017 and throughout 2018.

This is a big reason why management remains confident that GM can produce another year of record EPS in 2017 -- and continue growing earnings in 2018 and beyond -- despite facing tougher market conditions at home. North America certainly remains the key earnings driver for the General, but at least international markets are becoming less of a weight dragging it down.