Driverless cars are on the fast track to hitting the public roads. It's widely predicted that fully autonomous vehicles will be legal in the United States within the next decade, and perhaps sooner. IHS Automotive forecasts sales of 21 million self-driving cars in the year 2035 and sales of nearly 76 million globally through 2035. 

The growth opportunities stemming from this enormous technological shift promise to be immense, which is why the major auto companies, big technology players, and others are investing heavily in the space.

Two of the best stocks to profit from this trend are NVIDIA (NASDAQ:NVDA) and Tesla (NASDAQ:TSLA). Neither is a pure play -- there are no pure plays, to my knowledge -- but both promise to have a significant exposure to driverless cars. 

View of a driverless car with wing doors (doors hinged on the roof that open upward) open showing seats facing each other. There is no steering wheel.

Image source: Getty Images.

NVIDIA: An artificial-intelligence play on driverless cars

Graphics-chip specialist NVIDIA is not a newcomer to the auto market. Its Tegra processors have been used for some time to power automakers' infotainment and instrument clusters. In the past year, the company has also begun to profit from the race toward fully autonomous vehicles. CFO Colette Kress summed up NVIDIA's progress in this realm during the company's fiscal first-quarter 2018 earnings call: 

"We are continuing to expand our partnerships with companies using AI [artificial intelligence] to address the complex problem of autonomous driving. Since our DRIVE PX 2 AI car platform began shipping just one year ago, more than 225 car and truck makers, suppliers, research organizations, and start-ups have begun developing with it."

Also in May, NVIDIA announced a huge win in the driverless-car space: Toyota will use the DRIVE PX 2 platform to power its autonomous driving systems planned for market introduction. The companies didn't provide specifics, but the fact that Toyota is the No. 1 automaker in the world -- it's recently gained its top spot back from Volkswagen -- provides this partnership with significant growth potential for NVIDIA.

In October, electric-vehicle maker Tesla -- which we'll discuss further in a moment -- began using DRIVE PX 2 to power its Autopilot on all Model S and Model X vehicles. Its more affordable Model 3, scheduled for release later this year, will be similarly equipped. Other top automakers partnering with NVIDIA in their self-driving-vehicle initiatives include Volkswagen's Audi unit, Volvo, and Daimler's Mercedes-Benz. 

NVIDIA expects its DRIVE PX 2 platform to be capable of delivering Level 3 autonomy for cars, trucks, and shuttles by the end of the year, and Level 4 autonomy by the end of 2018. (Level 4 is just one step away from the fully autonomous level.) 

In the first quarter of fiscal 2018, NVIDIA's auto platform's revenue rose 24% year over year to $140 million, accounting for 7.2% of its total revenue of $1.94 billion. So auto is a relatively small part of the company's business -- which also targets the gaming, data-center, and professional visualization markets -- but it's growing quickly.

A Tesla Model 3 shown parked with a field in background.

The Model 3, which is slated for release later this year. Image source: Tesla.

Tesla: An automaker play on autonomous vehicles

As of October, all new Tesla vehicles come equipped with the "hardware needed for full self-driving capability at a safety level substantially greater than that of a human driver," according to Tesla. This includes a new on-board computer that reportedly has "more than 40 times the computing power of the previous generation." It's this computer -- which is powered by NVIDIA's DRIVE PX 2 AI platform -- that makes sense of all the data being taken in by the vision, sonar, and radar systems equipped on the vehicles.  

Before its NVIDIA partnership, Tesla had been teaming with Israeli company Mobileye on its Autopilot efforts, before the companies' ugly public breakup. (In March, chip giant Intel announced a $15.3 billion deal to buy Mobileye.) 

No other automaker is currently equipping all its new vehicles with the hardware needed for full self-driving capability. Given Tesla's current lead in this space, it seems likely that it will be a first mover in the auto industry in fully autonomous vehicles, once they become legal on public streets across the country. With the necessary hardware in place, all it should need to do is to continue to send out over-the-air software updates to enable increased Autopilot capabilities. Tesla's top-notch techie chops should provide it with a competitive advantage as cars become more and more like supercomputers on wheels.

Tesla is not a pure play on electric vehicles, so it won't be a pure play on driverless cars. The company, which acquired SolarCity last year, is also in the solar energy business -- both generation and storage. However, its auto-manufacturing business accounts for the lion's share of its revenue -- 84.9% of its total revenue of $2.7 billion in the first quarter of 2017 -- and should remain a sizable portion of its overall business. So Tesla should prove to be a considerable play on the burgeoning self-driving-vehicle space for many years.  

A Google self-driving vehicle in a suburban area.

Image source: Google.

What about Alphabet's Google?

Alphabet's (NASDAQ:GOOG)(NASDAQ:GOOGL) Google has long been the biggest name in driverless cars, as it was a pioneer in this space. Its self-driving-car project -- now called Waymo -- began testing autonomous cars in Mountain View, Calif., in 2009, and is now also testing them on public streets in Kirkland, Wash.; Austin, Texas; and Phoenix. Its fleet has driven more than 3 million miles, mostly on city streets, as of May.  

Alphabet is a top tech stock, and there are many reasons to favor it. However, as for tech plays, NVIDIA is likely to have a larger exposure to the driverless-vehicle space relative to its overall business. Moreover, NVIDIA is currently profiting from self-driving-car technology with its DRIVE PX 2 AI car platform, whereas Google's not yet making money in this realm.

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.