Many investors and auto industry pundits have been growing nervous about slowing U.S. auto sales recently. Most analysts expect new vehicle sales to decline 2%-3% year over year in the U.S. during 2017, roughly in line with the pace set during the first half of the year.

Ford (NYSE:F) and General Motors (NYSE:GM) both reported sales declines of about 5% in June, which might seem to support this narrative. However, if you dig a little deeper into the numbers, Ford and GM appear to be in much better shape than the popular narrative would suggest.

GM retakes the lead from Ford

In an unusual turn of events, Ford outsold General Motors (the perennial market leader) in the U.S. during May. In June, GM retook the top spot with 243,155 vehicle deliveries, compared to 227,979 for Ford.

A red Chevy Colorado pickup

GM returned to the No. 1 sales position in the U.S. last month. Image source: General Motors.

Retail sales trends were relatively comparable between the two months and roughly flat year over year for both automakers. An increase in deliveries to rental car companies for Ford -- combined with a decrease at GM -- was the main reason why Ford took the No. 1 sales spot in May.

By contrast, in June, Ford joined the auto industry trend by reducing the number of vehicles it sold to rental car companies. (These sales tend to carry low margins.) Indeed, Ford's 5% total sales decline last month was driven entirely by fleet sales -- primarily a reduction in daily rental deliveries. Retail sales were flat.

Similarly, GM's daily rental deliveries decreased by 54% in June, or nearly 11,000 units. This accounted for nearly all of GM's year-over-year sales decline last month.

Favorable mix shifts continue

While the total sales numbers at Ford and General Motors were nothing to write home about, both automakers continue to benefit from changing consumer tastes. Sales of cheaper, low-margin passenger cars are falling, while demand for pricey trucks, SUVs, and crossovers remains buoyant.

At Ford, car sales plunged 23% last month and declined 20% in the first half of the year. Meanwhile, Ford posted low-single-digit sales increases for SUVs (including crossovers) and trucks in June and for the full first half of 2017. Ford's hugely profitable F-Series truck lineup has sold particularly well this year, with deliveries up 8.8% year to date. This was the best first-half sales result for the F-Series since 2004, which was the best year ever for the F-Series.

The Ford F-150 pickup

Ford F-Series sales remained red-hot in June. Image source: Ford Motor Company.

At GM, pickup sales were roughly flat year over year in June. However, crossover sales surged, driven by strong demand for the Chevy Equinox, Buick Envision, Chevy Traverse, and GMC Acadia.

On the flip side, Chevrolet's six top-selling car models from last year -- the Spark, Sonic, Cruze, Malibu, Impala, and Camaro -- posted a ghastly combined sales decline of 43% in June. This reflects both lower deliveries to rental car fleets and the shift in consumer demand toward roomier vehicles.

Inventory remains the big question

In short, while auto industry sales may have peaked last year, sales declines are concentrated in the least profitable part of the market. As long as retail demand for pricey crossovers, SUVs, and trucks remains strong, Ford and General Motors should be able to generate strong profits.

High inventory is the biggest threat to continued prosperity in the auto sector. Even if retail demand remains solid, industry profits could still suffer if automakers are forced to offer huge discounts to pare down bloated inventories.

Ford has been quite proactive in managing its inventory. As of the end of June, its gross stock in the U.S. was down by more than 28,000 units compared to a year ago. By contrast, GM ended the month with 980,454 vehicles in inventory, up a whopping 39% from 706,558 a year ago.

GM's inventory situation remains a key factor to watch going forward. However, the company has already adjusted production to bring its inventory down. It also expects seasonally stronger sales in the second half of the year. Lastly, it has managed to keep discounting in check despite its high inventory. This may allow it to continue outpacing analysts' earnings expectations.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.