Accurate and automatic segmentation of the pectoralis muscle is essential in many breast image processing procedures, for example, in the computation of volumetric breast density from digital mammograms. Its segmentation is a difficult task due to the heterogeneity of the region, neighborhood complexities, and shape variability. The segmentation is achieved by pixel classification through a Markov random field (MRF) image model. Using the image intensity feature as observable data and local spatial information as a priori, the posterior distribution is estimated in a stochastic process. With a variable potential component in the energy function, by the maximum a posteriori (MAP) estimate of the labeling image, given the image intensity feature which is assumed to follow a Gaussian distribution, we achieved convergence properties in an appropriate sense by Metropolis sampling the posterior distribution of the selected energy function. By proposing an adjustable spatial constraint, the MRF-MAP model is able to embody the shape requirement and provide the required flexibility for the model parameter fitting process. We demonstrate that accurate and robust segmentation can be achieved for the curving-triangle-shaped pectoralis muscle in the medio-lateral-oblique (MLO) view, and the semielliptic-shaped muscle in cranio-caudal (CC) view digital mammograms. The applicable mammograms can be either “For Processing” or “For Presentation” image formats. The algorithm was developed using 56 MLO-view and 79 CC-view FFDM “For Processing” images, and quantitatively evaluated against a random selection of 122 MLO-view and 173 CC-view FFDM images of both presentation intent types.