Tesla's shares jumped by more than 12 percent after the company reported a surprise profit for the third quarter.