A device for visual inspection of narrow spaces and objects located in narrow spaces such as solder joints between a component and a printed circuit board has an image prism for deflecting light from the spaces and objects to be inspected and an image sensor that can be connected to a display. For illuminating the solder joints light sources are provided that are located at the transmission path of light from the image prism to the image sensor. The light sources are connected to light guides having outlet ends that are located to issue light at the sides of the light entrance surface of the image prism. Special illumination prisms can be provided to direct the light. The issued light is directed to the field of view, if desired in directions obliquely down into the surface at which the spaces or objects are located and in a weakly converging fashion. Extra light sources can be connected to light guides of a background illumination unit. The light guides may be part of an illuminating unit that can be attached the rest of the device by a snapping function.