NA64 is a fixed target experiment at the CERN SPS aiming at a sensitive search for hidden sectors. In this talk, we will present our latest results on the search for a new sub-GeV vector gauge boson (A′) mediated dark matter (χ) production. The A′, called dark photon, could be generated in the reaction e−Z→e−ZA′ of 100 GeV electrons dumped against an active target which is followed by the prompt invisible decay A′→χχ. The experimental signature of this process would be a clean event with an isolated electron and large missing energy in the detector. This allows us to set new limits on the γ−A′ mixing strength and constrain the new parameter space for the most interesting light dark matter models. Results on the search for the visible A' -> e+e− decays, as well as X→ e+e− decay of a new 17 MeV X boson, which could explain a recently observed anomaly in the 8Be transitions will be also discussed.