The rapid spread of coronavirus SARS-CoV-2 greatly threatens global public health but no prophylactic vaccine is available. Here, we report the generation of a replication-incompetent recombinant serotype 5 adenovirus, Ad5-S-nb2, carrying a codon-optimized gene encoding Spike protein (S). In mice and rhesus macaques, intramuscular injection with Ad5-S-nb2 elicits systemic S-specific antibody and cell-mediated immune (CMI) responses. Intranasal inoculation elicits both systemic and pulmonary antibody responses but weaker CMI response. At 30 days after a single vaccination with Ad5-S-nb2 either intramuscularly or intranasally, macaques are protected against SARS-CoV-2 challenge. A subsequent challenge reveals that macaques vaccinated with a 10-fold lower vaccine dosage (1 × 1010 viral particles) are also protected, demonstrating the effectiveness of Ad5-S-nb2 and the possibility of offering more vaccine dosages within a shorter timeframe. Thus, Ad5-S-nb2 is a promising candidate vaccine and warrants further clinical evaluation.