The Mattress Stitch is a finishing technique for vertical seaming. It creates an invisible join between pieces worked in stockinette stitch or ribbing, perfect for so many things, such as sewing the front and back of a sweater together. For demonstration purposes, I have used a different yarn in a contrasting color, but typically you would use the same yarn as your knit pieces.
First, align the two pieces you wish to seam. Bring your threaded tapestry needle from the back of your work to the front at the location where you wish your seam to start. (I began with the knit piece to the right and brought my needle to the front just above my cast on edge.)
For Mattress Stitch you sew two knit pieces together by grabbing a strand of yarn from each edge, alternating back and forth, working vertically along the edges. The strand of yarn you grab is a horizontal bar that runs between the knit stitches (or "V"s). If you gently tug on the right and left edge of your knit piece, you can see these horizontal bars (or "ladder") between the Vs. Picking up a bar from each side draws the edges together, making it appear as though it is one knit piece.
Next, draw the needle under the bar between the two most outer Vs of the second knit piece, right across your entry of the first edge. Beware of the outermost column of knit stitches; it tends to curl to the back. The farther in from the edge that you work, the bulkier the seam will be.
Take the tapestry needle back to the first piece and pick up the bar just above your initial entry point.
Now, take the needle back to the second piece and pick up the bar above the last one your picked up on this side.
Note: Depending on the gauge or density of the fabrics, sometimes it is just as effective to pick up every other bar, rather than ever bar. It is a personal choice.
Continue working vertically along the two edges, drawing the tapestry needle under each bar of each piece.
Above you can see the many red stitches connecting the two columns of Vs. The goal is to bring those Vs together.
Just as with knitting, the more even you can keep your tension, the better. An even tension will prevent pulling and puckering along the seam.
To close the seam, gently pull the length of yarn from either the top or the bottom. If you are working a long seam, it is best to sew a few inches, then pull to close, again sew a few inches and pull, continuing in this fashion to the end of the seam, being careful to maintain a consistent tension throughout.
It's like magic.
If you turn your work over so the wrong side is facing, you'll see the seam.