BERLIN—A group of German auto makers agreed to pay slightly more than €2.5 billion ($2.7 billion) for Nokia’s digital mapping service, prevailing over Silicon Valley bidders in a battle for a key enabling technology for self-driving cars.

German luxury car makers Audi, a unit of Volkswagen AG , Mercedes-Benz parent Daimler AG , and BMW AG have agreed in principle to purchase the telecommunications group’s digital mapping service Nokia Here, according to a person familiar with the situation.

If a deal is struck, which isn’t yet certain, the German auto makers plan to invite other automotive companies such as Fiat Chrysler Automobiles NV, Renault SA, PSA Peugot Citroën, Ford Motor Co., Toyota Motor Corp. and General Motors Co. to invest in Nokia Here, two people familiar with the situation said.

“The goal has always been to run the service as an open platform for everyone,” one person said. “The final signing could take place in the next few days.”

Nokia Here generated more than half its €970 million in 2014 sales from the auto industry, and the rest from location-based services. The deal price might be less than Nokia hoped to achieve. Nokia built the business out of Navteq, a mapping service that it bought in 2008 for $8.1 billion.