A method for producing an implant and the implant itself, particularly an intraluminal endoprosthesis, wherein the implant is produced from a preferably hollow cylindrical semifinished article (10), wherein the semifinished article contains magnesium or a magnesium alloy, the method comprising preparing the semifinished article (10), and shaping the semifinished article at a temperature of between 250° C. and 550° C. using a tool, which has a metallic lubricant containing gallium and/or a gallium compound on at least a part of its surface that will come into contact with the semifinished article.