Place the mantel shelf on the wall in the desired location. Set a level on the mantel shelf and make any necessary adjustments. Use a pencil to draw a line on the wall along the mantel's surface. Set the mantel aside.
Flip the mantel shelf over so the back is visible. Measure down from the mantel shelf's surface to the gap. Transfer this measurement to the wall, measuring down from the pencil line you drew in step 1. Use the level as a straightedge to draw a second line.
Run a stud finder along the second line. Mark the location of each stud you come across. Set the cleat on the wall. Line up the cleat's top edge with the second pencil line. Place a level on the cleat and make any necessary adjustments.
Drill a 1/8-inch pilot hole through the cleat and into each wall stud the cleat intersects. Drive a 2-inch screw through each pilot hole. Place a tube of construction adhesive in a caulk gun and cut off the tip with a utility knife. Run a bead of adhesive along the cleat's top edge.
Fit the mantel over the cleat and push it tight against the wall. Drill four 1/16-inch pilot holes through the mantel and into the cleat's top edge. Hammer a finishing nail through each pilot hole.