This study investigated the genetic polymorphisms of HLA-B27, together with polymorphisms on endoplasmic reticulum aminopeptidase 1 (ERAP1), and susceptibility for ankylosing spondylitis (AS) in the Beijing Han population. A case-control study was carried out for 602 AS patient samples and 619 matched controls of Han Chinese. HLA-B27 genotyping was performed by polymerase chain reaction-sequence specific primers (PCR-SSP), and four ERAP1 SNPs (rs27037, rs27980, rs27582, and rs27434) were selected and genotyped on the Sequenom iPlex platform (Sequenom, San Diego, CA). Association analysis was performed using the likelihood ratio χ2 test. This study identified four HLA-B27 alleles in Beijing Han AS patients, B*27:02, B*27:04, B*27:05, and B*27:07, of which B*27:05 was the most significant geographical different subtype among AS patients in Chinese. Our results confirmed that HLA-B27 was strongly associated with AS (P = 1.9 × 10−150), and the most strongly associated alleles were B*27:04, B*27:05, and B*27:02. Our study also confirmed a weak association between ERAP1 (rs27434) and AS. We also observed that for HLA-B*27:02 and HLA-B*27:04 positive AS patients, rs27434 and rs27582 were associated with AS. In contrast, for HLA-B27-negative and HLA-B*27:05-positive AS patients, this association was not observed. This is the first study to show that both B27 and ERAP1 are AS genetic susceptibility genes in Beijing Han. Interactions between ERAP1 and HLA-B*27:02 and B*27:04 may play an important role in the AS pathogenesis.