Stock market: Energy stocks lead gains, Tesla stock slides