Determine the location of the studs in the wall, using a stud finder. Plan the opening of your recessed shelves so that the sides are even with studs. This saves you the trouble of installing new studs in the wall.
Outline the area where you want the shelves to go by drawing on wall with a pencil and a 4-foot level. The 4-foot level will act as a straightedge while simultaneously allowing you to keep your lines level and square.
Cut along the lines that you made with a drywall saw and remove the drywall. If the area of your shelves spans more than two studs, you will have studs passing through the open area. Rather than going through the hassle of removing these, use them as verticals between your shelves to add to shelf strength.
Measure the distance between the studs in your wall. If it's a standard wall, the distance should be 14 1/2 inches. Cut boards to this length so that they fit snugly between the studs.
Place the boards between the studs. Measure up from the bottom of the opening at both ends of a shelf to be sure it's level. Attach the shelf to the studs by driving screws at a 45-degree angle through the bottom face of the shelf and into the stud on both ends of the shelf.