NPT = National Pipe Tapered
NPS = National Pipe Straight
The threads are identical but there is a slight taper to NPT fittings. For best sealing, NPT-NPT and NPS-NPS is recommended. In general, NPS female on NPT male threads works fairly well but NPT female on NPS male threads is not as good.
However, if you use enough teflon tape, you can probably get by with an NPT female cap on an NPS male pipe. If you have leaks at that fitting though, you may need more tape or other sealant or look for an NPS cap.
FWIW, NPSM = National Pipe Straight Mechanical -- no difference from NPS, the M is simply used to avoid confusion with the abbreviation of NPS for "nominal pipe size"