In this paper we propose a new pixel clustering model applied to the analysis of digital mammograms. The clustering represents here the first step in a more general method and aims at the creation of a concise data-set (clusters) for automatic detection and classification of masses, which are typically among the first symptoms analysed in early diagnosis of breast cancer. For the purpose of this work, a set of mammographic images has been employed, that are 12-bit gray level digital scans and as such, are inherently inhomogeneous and affected by the noise resulting from the film scanning. The image pixels are described only by their intensity (gray level), therefore, the available information is limited to one dimension. We propose a Markov random field (MRF)-based technique that is suitable for performing clustering in an environment which is described by poor or limited data. The proposed method is a statistical classification model, that labels the image pixels based on the description of their statistical and contextual information. Apart from evaluating the pixel statistics, that originate from the definition of the K-means clustering scheme, the model expands the analysis by the description of the spatial dependence between pixels and their labels (context), hence leading to the reduction of the inhomogeneity of the output. Moreover, we define a probabilistic description of the model, that is characterised by a remarkable simplicity, such that its realisation can be easily and efficiently implemented in any high- or low-level programming language, thus allowing it to be run on virtually any kind of platform. Finally, we evaluate the algorithm against the classical K-means clustering routine. We point out similarities between the two methods and, moreover, show the advantages and superiority of the MRF scheme.