In this paper, we introduce a new notion called the box-counting measure of a metric space. We show that for a doubling metric space, an Ahlfors regular measure is always a box-counting measure; consequently, if E is a self-similar set satisfying the open set condition, then the Hausdorff measure restricted to E is a box-counting measure. We show two classes of self-affine sets, the generalized Lalley-Gatzouras type self-affine sponges and Barański carpets, always admit box-counting measures; this also provides a very simple method to calculate the box-dimension of these fractals. Moreover, among others, we show that if two doubling metric spaces admit box-counting measures, then the multi-fractal spectra of the box-counting measures coincide provided the two spaces are Lipschitz equivalent.