Daimler AG posted far higher earnings than analysts expected by joining peers in commanding better pricing for vehicles in the midst of the global semiconductor shortage.

Preliminary earnings before interest and taxes surged to 5.19 billion euros (US$6.1 billion) in the second quarter, the Mercedes-Benz maker said late Wednesday, beating a company-compiled consensus of 4.11 billion euros. Profit margin at the cars and vans division reached double digits for a third straight quarter.

Daimler joins Volkswagen AG and Jeep maker Stellantis NV in reporting that it’s coping well with the scarcity of chips that has constrained car production since late last year. Facing limitations on just how many assembly lines they can keep running, automakers are prioritizing output of their biggest money makers and abstaining from discounts customers are accustomed to even from luxury brands.

“Daimler’s shift to higher-margin vehicles in light of the semiconductor shortage issue likely helped propel margins above normal levels,” Tom Narayan, an analyst at RBC Capital Markets with the equivalent of a buy rating, said in a note. He expects Mercedes rival BMW AG “could similarly pre-announce to the upside.”

Daimler shares rose as much as 1.8 per cent shortly after the open of regular trading in Frankfurt. The stock is up about 28 per cent this year.

The auto industry is having an outsize effect on consumer prices moving up in economies including the U.S. and U.K., and the forces at play are unlikely to change anytime soon. VW said last week it expects the chip shortage to have a bigger impact on its operations in the second half of the year.

Daimler forecast in April that its main Mercedes-Benz unit will be more profitable than it’s been in years, thanks to resurgent demand for cars and trucks in the midst of the global pandemic. It raised its projection for annual return on sales for its cars and vans division to 10 per cent to 12 per cent, up from 8 per cent to 10 per cent.

Like VW last week, Daimler neglected to newly raise projections for the year in its preliminary report.

A year after the auto industry’s worst crisis in decades, business for German premium carmakers has roared back to record levels, driven by red-hot demand in China, their largest market. Getting earnings back on track will be pivotal to financing investments in electrification and software development as the industry segues to more technologically advanced, battery-powered vehicles.

Mercedes this year revved up its electric-car rollout with the new EQS sedan, the battery-powered sibling to its flagship S-Class, as traditional carmakers broaden their attack on Tesla Inc. The company will be making eight fully electric cars on three continents next year.

Daimler is preparing to spin off of its sprawling truck division later this year. The company expects the move to help it better tackle diverging technology trends in the passenger-car and commercial-vehicle industries.

Full quarterly results will be released on July 21.