Spatial filtering is an important mechanism to improve the spatial quality of laser beams. Typically, a confocal arrangement of lenses with a diaphragm in the focal plane is used for intracavity spatial filtering. Such conventional filtering requires access to the far-field domain. In microlasers, however, conventional filtering is impossible due to the lack of space in microresonators to access the far-field. Therefore, a novel concept for more compact and efficient spatial filtering is necessary. In this study, a conceptually novel mechanism of spatial filtering in the near-field domain is proposed and demonstrated, by a nanostructured multilayer coating-a 2D photonic crystal structure with a periodic index modulation along the longitudinal and transverse directions to the beam propagation. The structure is built on a nanomodulated substrate, to provide the transverse periodicity. The physical vapor deposition is used to provide self-repeating modulation in the longitudinal direction. A 5 mu m thick photonic multilayer structure composed of nanostructured multiple layers of alternating high- and low-index materials providing spatial filtering in the near-infrared frequencies with 2 degrees low angle passband is experimentally demonstrated. The proposed photonic structure can be considered as an ideal component for intracavity spatial filtering in microlasers.