Needle thread tension for sewing parallel and bar tacking sections of buttonholes can be separately controlled through the operation panel and stored in memory according to various sewing conditions (e.g., type of thread, type of material, and sewing speed). The machine is able to change the needle thread tensions at the parallel and bar tacking sections of the buttonhole. to produce a beautiful buttonhole shape. This capability helps greatly in preventing thread breakage. Needle thread tension is activated at the beginning and end of sewing. This prevents unthreading of the needle thread. and thread fraying that is likely to occur at the beginning of sewing. Thread tension for basting stitching can be specified separately.