Tesla posts higher-than-expected profit on delivery growth