We report on radial velocity time series for two M0.0V stars, GJ 338 B and GJ 338 A, using the CARMENES spectrograph, complemented by ground-telescope photometry from Las Cumbres and Sierra Nevada observatories. We obtained 159 and 70 radial velocity measurements of GJ 338 B and A, respectively, with the CARMENES visible channel between 2016 January and 2018 October. We also compiled additional relative radial velocity measurements from the literature and a collection of astrometric data that cover 200yr of observations to solve for the binary orbit. We found dynamical masses of 0.64+/-0.07M_{sun} for GJ338B and 0.69+/-0.07M{sun} for GJ338A. The CARMENES radial velocity periodograms show significant peaks at 16.61+/-0.04d (GJ 338 B) and 16.3+/-3.5d (GJ 338 A), which have counterparts at the same frequencies in CARMENES activity indicators and photometric light curves. We attribute these to stellar rotation. GJ 338 B shows two additional, significant signals at 8.27+/-0.01 and 24.45+/-0.02d, with no obvious counterparts in the stellar activity indices. The former is likely the first harmonic of the star's rotation, while we ascribe the latter to the existence of a super-Earth planet with a minimum mass of 10.27+/-1.47M{Earth}_ orbiting GJ 338 B.