Nanofocus x-ray tube, includes a target, and a device for directing an electron beam onto the target. The target includes at least one target element made of a target material for generating x-rays, the at least one target element including a nanostructure having a diameter ≦about 1000 nm. The nanostructure is formed by a microstructuring procedure on a substrate element made of a substrate material, and the target element only partly covers the substrate element. The electron beam cross-section of the x-ray tube, in use, is selected to be sufficiently larger than the cross-section of the target element, such that the electron beam always irradiates the entire surface of the target element. Still further, the substrate material may be diamond, or the substrate material may include diamond, and being doped to raise the electrical conductivity.