This study aims to determine the level of adherence to treatment in ankylosing spondylitis (AS) patients and to identify possible factors associated to lack of adherence. We included consecutive AS patients (NY modified criteria). Sociodemographic and clinical data were collected. Patients answered auto-reported questionnaires: Bath Ankylosing Spondylitis Disease Activity Index, Bath Ankylosing Spondylitis Functional Index, Ankylosing Spondylitis Quality of Life, and Center for Epidemiological Studies Depression scale. Patients with rheumatoid arthritis (RA) (ACR'87 criteria) were assessed as the control group. The adherence of the studied groups to medical treatment and exercises was measured by means of two questionnaires: Compliance Questionnaire on Rheumatology (CQR) and Exercise Attitude Questionnaire-18 (EAQ-18). The study included 59 patients with AS and 53 patients with RA. Of the AS patients, 43 (72.9%) were male, median age 47 years (interquartile range (IQR) 33-57) and median disease duration of 120 months (IQR 33-57). Of the RA patients, 37 (69.8%) were female, had a median age of 56 years (IQR 43.5-60) and a median disease duration of 156 months (IQR 96-288). There were no significant differences in the results of the adherence questionnaires between both groups, with a total median of 68.42 for the CQR in both groups and of 40.7 in AS vs. 42.6 in RA for the EAQ. When dichotomizing patients as adherent and non-adherent, taking as good adherence a cut value in the CQR and EAQ higher than 60, adherence to pharmacological treatment was significantly higher in RA vs. AS (92.5 vs. 74.6%, p = 0.01) and there were no differences in the EAQ. On the uni- and multivariate analysis, lack of adherence to treatment was not associated to sex, age, disease duration, education, health insurance, depressive status, and disease activity parameters in neither group of patients. AS have an acceptable adherence to pharmacological treatment, although it is lower than RA patients; nonetheless, both groups show a lack of adherence to exercise.