Remote sensing image retrieval (RSIR) is the process of searching and acquiring similar images to a query image in a large-scale remote sensing image database. Several recent studies encourage the discriminative feature space by developing loss functions under the deep metric learning paradigm. However, there are still some problems that have not been well resolved. The first is that for each category in the RSIR data set, the similarity among the samples within the category is different, so the samples and the number of samples that need to be learned should also be different. We propose intraclass space sample mining, which selects “misplaced” samples based on the distribution of samples, instead of artificially setting the boundary threshold of sample mining as usual. The second problem is the inconsistency between the loss reduction direction and the optimization direction. We propose the cost-sensitive loss (CSL) by penalizing the error samples in the candidate list. As a plug-in, CSL combined with other local losses can effectively improve retrieval accuracy. Finally, in view of the problem that the current loss is optimized based on local space and cannot distinguish different categories with high similarity, we propose a global-aware ranking loss (GRL) model. This is a global optimization model based on the feature space and retrieval candidate list. We have conducted comprehensive experiments on two public remote sensing data sets. Compared with the baseline, our proposed algorithm can achieve state-of-the-art performance.