We propose and analyze a scheme for ultrafast spectroscopy with nanometer spatial and femtosecond temporal resolution. The interaction of polarization-shaped laser pulses with a nanostructure allows us to control the spatial and temporal evolution of the optical near field. Employing a learning algorithm, the field is tailored such that pump and probe excitation occur at different positions and at different times. Both excitations can be restricted to subdiffraction extensions and are separable on a nanometer length scale. This enables the direct spatial probing of nanoscale energy transfer or charge transfer processes.