Nitrosopumilus maritimus is an ammonia-oxidizing archaeon that is crucial to the global nitrogen cycle1,2. A critical step for nitrogen oxidation is the entrapment of ammonium ions from a dilute marine environment at the cell surface and their subsequent channelling to the cell membrane of N. maritimus. Here we elucidate the structure of the molecular machinery responsible for this process, comprising the surface layer (S-layer), using electron cryotomography and subtomogram averaging from cells. We supplemented our in situ structure of the ammonium-binding S-layer array with a single-particle electron cryomicroscopy structure, revealing detailed features of this immunoglobulin-rich and glycan-decorated S-layer. Biochemical analyses showed strong ammonium binding by the cell surface, which was lost after S-layer disassembly. Sensitive bioinformatic analyses identified similar S-layers in many ammonia-oxidizing archaea, with conserved sequence and structural characteristics. Moreover, molecular simulations and structure determination of ammonium-enriched specimens enabled us to examine the cation-binding properties of the S-layer, revealing how it concentrates ammonium ions on its cell-facing side, effectively acting as a multichannel sieve on the cell membrane. This in situ structural study illuminates the biogeochemically essential process of ammonium binding and channelling, common to many marine microorganisms that are fundamental to the nitrogen cycle.