The electric carmaker Tesla Motors said on Wednesday that it earned $22 million in the third quarter, its first profitable period since 2013, raising expectations for the success of its expansion plans. The company’s chief executive, “We were able to have our best quarter ever, and we are heading toward a great fourth quarter as well,” Mr. Musk said in a conference call with analysts. Mr. Musk has been pushing for efficiencies throughout the company,…