Put a moisture barrier under the insulation. Use panels with moisture facing if possible. Place the barrier below the insulation, toward the "warm" zone. Use "thermal spacers" supplied by an insulation manufacturer to separate the metal slightly from the foam board. Place spacers under seams of the roof panels.
Fasten foam insulation to roof decking with galvanized nails, clips or adhesive, depending on the type of insulation and manufacturer. Place special metal flashing at peaks and eaves, adapted to the method of fastening the roofing panels; these typically are metal strips bent to overlap the wall or facing board at the edge of the roof, with a second strip fastened to the roof decking through the foam board and sliding under the outside flashing strip.
Match type and depth of insulation to the weather conditions. Polyisocyanurate is a preferred material because it has the highest heat resistance or R value of foam insulation and works well with the metal clips usually used to fasten standing seam panels; extruded polystyrene (XPS) is a sturdy foam that can be used in some applications. Avoid penetrating the facing on polyiso because it must remain sealed to retain its effectiveness. Fasten XPS directly to solid wood roof decking with a hammer and galvanized nails. Seal seams of foam insulation with tape from the same manufacturer.
Choose insulated metal panels for some applications. Some manufacturers provide panels that have some foam insulation built into the panel; styles vary by maker and pattern of standing seams. Insulated panels are available in depths from 1 1/4 to 6 inches, depending on the amount of insulation needed; these simplify installation because insulation and roofing are installed as one piece.