In materials science and biology, optical near-field microscopies enable spatial resolutions beyond the diffraction limit, but they cannot provide the atomic-scale imaging capabilities of electron microscopy. Given the nature of interactions between electrons and photons, and considering their connections through nanostructures, it should be possible to achieve imaging of evanescent electromagnetic fields with electron pulses when such fields are resolved in both space (nanometre and below) and time (femtosecond). Here we report the development of photon-induced near-field electron microscopy (PINEM), and the associated phenomena. We show that the precise spatiotemporal overlap of femtosecond single-electron packets with intense optical pulses at a nanostructure (individual carbon nanotube or silver nanowire in this instance) results in the direct absorption of integer multiples of photon quanta (nhomega) by the relativistic electrons accelerated to 200 keV. By energy-filtering only those electrons resulting from this absorption, it is possible to image directly in space the near-field electric field distribution, obtain the temporal behaviour of the field on the femtosecond timescale, and map its spatial polarization dependence. We believe that the observation of the photon-induced near-field effect in ultrafast electron microscopy demonstrates the potential for many applications, including those of direct space-time imaging of localized fields at interfaces and visualization of phenomena related to photonics, plasmonics and nanostructures.