Ankylosing spondylitis is a type of inflammatory arthritis associated with the HLA-B27 gene. It typically causes stiffness and fusion of the spine over time. Diagnosis involves evidence of sacroiliac joint inflammation on imaging and a positive HLA-B27 test in most cases. Treatment focuses on exercises to maintain mobility, nonsteroidal anti-inflammatory drugs, and TNF inhibitors for severe cases. Surgery may be needed to correct spinal deformities or replace affected hips in advanced ankylosing spondylitis.