Manchester City got away with a nervous second half performance to beat Leeds United 3-2 at the Etihad.