A system including an implantable fastener for fastening layers of tissue is disclosed. In one embodiment, the fastener includes a proximal anchor member and a distal anchor member each being movable from a reduced profile position to a deployed position. The anchor members are mesh structures capable of moving to the deployed position by reducing the axial spacing between opposite ends of the anchor members.Methods of treating gastroesophageal reflux disease (GERD) are also disclosed. One of the methods includes placing the distal anchor member through a hole formed in the wall of the esophagus and through a hole formed in the gastric wall. The distal anchor member and the proximal anchor member are then placed in their deployed positions to fasten the wall of the esophagus and the gastric wall together between the anchor members.