We investigated the structure of liquid water around cations (Na+) and anions (Cl–) confined inside of a (19,0) carbon nanotube with first-principles molecular dynamics and theoretical X-ray absorption spectroscopy (XAS). We found that the ions preferentially reside near the interface between the nanotube and the liquid. Upon confinement, the XAS signal of water molecules surrounding Na+ exhibits enhanced pre-edge and reduced post-edge features with respect to that of pure water, at variance with the solvation shell of Na+ in bulk water. Conversely, the first solvation shell of confined Cl– has a main-edge intensity comparable to that of bulk solvated Cl–, likely as a result of a high number of acceptor hydrogen bonds in the first solvation shell. Confined nonsolvating water molecules exhibit bulk-like or water-monomer-like properties, depending on whether they belong to core or interfacial layers, respectively.