• Needle & Thread
Start from the inside (the "wrong" side of the fabric that you do not want showing), and keep your stitches close to the edge. Make sure your stitches aren't too close together, or this won't work. Generally, they can be about a pinky finger's width apart, but with varying sizes of fingers and buttons, it may just take some practice and guessing.
NOTE: If you wait too long to do this, you will not be able to pull the thread all the way through, it will get stuck on the fabric. It may take some practice to learn when to pull the thread through, it also depends on the thickness of the fabric and the strength of your thread.
Tug on the needle to make the fabric into a pocket (make sure it's right-side out!) and set the button inside. You'll want the button to be face-down.