Images uploaded to media sharing websites are usually associated with a set of user-provided tags, which makes it easy to retrieve images of interest by treating the tags as index terms. However, the existing methods for tag-based image retrieval usually return irrelevant images or low-quality images. It has been argued that relevance and quality are the two most important measures for users to evaluate the performance of an image retrieval system. Therefore, in this paper, we propose an image retrieval scheme which considers the relevance and quality of an image simultaneously. Firstly, a relevance-based algorithm is utilized to rank each image in the database according to its relevance of an input query tag by taking into account both the visual similarity of image content and the semantic consistency of query tag. Then, the information of image quality score is added to refine the relevance score of each candidate image in the ranking list. Experimental results on NUS-WIDE image database and Corel image database demonstrate the effectiveness of the proposed scheme.