Cut a slot into the side of the wood that will be hidden. This can be done with a table saw, or if the length of the wood makes this unwieldy, with a chisel. The slot should start at the end of the wood piece and be open ended, and should sink no further than halfway through the board.
Cut a notch on the second piece of wood so that it can be slid into the slot on the first piece of wood. Make sure that you measure it so it will fit snugly into the slot. Use a jigsaw or a chisel to make the cut.
Coat the notch with carpenter's glue.
Slide the notch into the slot. Clamp it into place while the glue dries.
Wipe away any excess glue.