We propose a new approach to examine the rank correlation between two variables X and Y while adjusting for continuous and/or categorical covariates Z. Our approach first fits two separate regression models of X on Z and Y on Z, obtains probability-scale residuals from these two models, and then tests for correlation between the residuals. The probability scale residual is defined as pr(Y*<y)-pr(Y*>y) where y is the observed value and Y* is a random variable from the fitted distribution. In the absence of covariates, this residual can be written as a linear transformation of the ranks, and our test statistics is therefore equivalent to Spearman's rank correlation. With covariates, this test statistic estimates the average rank correlation across different levels of Z. Therefore, our approach can be considered a generalization of Spearman's rank correlation in the presence of covariates. Through simulations, we demonstrate that our approach shares some of the good properties of Spearman's rank correlation: 1) it can handle ordinal variables; 2) it can efficiently capture non-linear monotonic correlation; 3) it is robust to outliers; and 4) it is invariant under monotonic transformations of X and Y when residuals are computed from ordinal regression models. We illustrate the application of this approach by assessing the correlation between wages and education in the United States, and by examining the correlation between various questions in a large survey measuring sanitation practices, education, health, and other quality-of-life metrics among women in Mozambique.