We present a detailed study of the optical trapping and manipulation of nanoparticles with complex permittivity using an apertureless near-field probe. We use a three-dimensional, self-consistent description of the electromagnetic scattering processes that accounts for retardation and the intricate many-body interaction between the substrate, the particle, and the probe. We analyze the influence of absorption on the optical force. For metals we describe how the optical force spectrum is influenced by the optical response of the metal, and in particular by plasmon resonances. We find that the optical force spectrum can provide an intrinsic signature of the particle composition which can be used to achieve a material-selective trapping and nanomanipulation.