Recent advances in deep learning have led to an accurate diagnosis of pneumonia from chest X-ray images. However, these models usually require large labeled training datasets, not always available in practice. Furthermore, combining images from different medical centers does not preserve the accuracy of the results mainly because of differences in image acquisition settings. In this work, we propose an approach aiming to overcome this challenge, consisting of a subspace-based domain adaptation technique to increase pneumonia detection accuracy using a small training dataset. This dataset is augmented with automatically selected images from a large dataset acquired in a different medical center. This is performed by computing a subspace basis of the target domain dataset on which is projected the source dataset to find the most representative images. Augmenting the training set using the proposed method allows achieving an improvement from 90.03% to 96.18% in overall accuracy using the Xception neural network.