Antitumor necrosis factor (TNF) agents have been widely used for the treatment of spondyloarthritis (SpA) and ankylosing spondylitis (AS). However, these agents may increase the risk of infection due to suppressing the immune response. The present meta-analysis was performed to systematically investigate the risk of overall infection, serious infection and tuberculosis in patients with SpA and AS treated with anti-TNF agents. Medline, Embase and the Cochrane library were searched for randomized controlled trials (RCTs) published between January 1998 and December 2015 about infection in patients with SpA receiving anti-TNF therapy. Data were pooled to obtain relative risks (RRs) along with their 95% confidence intervals (CIs). A total of 25 RCTs investigating SpA, including 12 investigating AS specifically, were eligible for the meta-analysis. Similar risks of overall infection were reported in patients with SpA (RR, 1.03; 95% CI, 0.92-1.15) and AS (RR, 1.06; 95% CI, 0.91-1.24) treated with anti-TNF agents. The RR of serious infection for patients with SpA or AS receiving anti-TNF therapy compared with a placebo was 1.27 (95% CI, 0.67-2.38) and 1.57 (95% CI, 0.63-3.91), respectively. In addition, 4 RCTs with outcomes of tuberculosis in patients with SpA receiving anti-TNF agents were identified, all in infliximab-treated patients (RR, 2.52; 95% CI, 0.53-12.09). However, due to the limited number of RCTs, this finding should be interpreted with caution. The present meta-analysis did not find any significantly increased risk of infection associated with anti-TNF therapy in patients with SpA or AS. However, due to short duration of follow-up in the RCTs and the rarity of serious infections and tuberculosis, patients treated with anti-TNF agents still should be closely monitored in clinical practice.