Pep Guardiola's side were made to dig deep against a resilient Leeds to take a much-needed win at the Etihad Stadium.