Tesla on Wednesday handily beat quarterly profit estimates and reported automotive gross margin in line with Wall Street expectations, signaling it was gaining ground in the electric-vehicle price war ignited by CEO Elon Musk. Under pressure from increasing competition and an uncertain economy, Tesla has slashed prices several times in the US, China and other markets since late last year, and increased discounts and other incentives to reduce inventory. This has pressured its industry-leading automotive gross margin, a closely watched indicator of the company’s financial health, but Musk has said Tesla would sacrifice margins to drive volume growth. For instance,...