An endoprosthesis, in particular an intraluminal endoprosthesis, for example a stent, having a base body composed at least partially of a metallic material, and having a functional element which is attached to the base body or imbedded therein and which contains material that is radiopaque and/or X-ray opaque and has a different material composition, at least in a portion of its volume, compared to the material of the base body. To avoid contact corrosion and undesired corrosion, the functional element is provided with a barrier layer which electrically insulates the radiopaque and/or X-ray opaque material from the base body.