Spectra of positively charged kaons in p+C interactions at 31 GeV/c were measured with the NA61/SHINE spectrometer at the CERN SPS. The analysis is based on the full set of data collected in 2007 with a graphite target with a thickness of 4% of a nuclear interaction length. Interaction cross sections and charged pion spectra were already measured using the same set of data. These new measurements in combination with the published ones are required to improve predictions of the neutrino flux for the T2K long-baseline neutrino oscillation experiment in Japan. In particular, the knowledge of kaon production is crucial for precisely predicting the intrinsic electron neutrino component and the high-energy tail of the T2K beam. The results are presented as a function of laboratory momentum in two intervals of the laboratory polar angle covering the range from 20 to 240 mrad. The kaon spectra are compared with predictions of several hadron production models. Using the published pion results and the new kaon data, the K+/π+ ratios are computed. © 2012 American Physical Society.