We investigate the impact of audit firm tenure, partner tenure, audit fees, fees for non-audit services and total fees on audit quality, as measured by discretionary accruals. Our sample consists of Spanish non-financial public companies for the years between 2006 and 2013. Results indicate that audit quality increases with audit firm tenure but decreases with partner tenure. Moreover, the level of fees paid to the audit firm seems to have a negative impact on audit quality, which is mainly driven by fees for audit services. In this regard, we do not observe any significant relationship between fees for non-audit services and audit quality. Our results also show that the negative relationship between either long partner tenures or high fees and audit quality does not occur when the tenure with the audit firm is long. Therefore, long audit firm tenures do not only seem to involve higher audit quality ‘per se’, but also moderate the negative effects of partner tenure and audit fees on audit quality. The results of this study, which are robust to several sensitivity checks, may be relevant for the current debate on auditor rotation and the joint provision of audit and non-audit services.