The fundamentals of the near-field interaction between a subwavelength metallic tip and a photonic-crystal nanocavity are investigated experimentally and theoretically. It is shown experimentally that the cavity resonance is tuned without any degradation by the presence of the tip and that the reported near-field interaction is strongly related to the field distribution within the nanostructure. Then, in light of a perturbation theory, we show that this interaction is selectively related to the electric field or magnetic field distribution within the cavity, depending on the tip properties. © 2007 The American Physical Society