Chemokines and their receptors play important roles in normal physiological functions and the pathogeneses of a wide range of human diseases, including the entry of human immunodeficiency virus type 1 (HIV-1). However, the use of natural chemokines to probe receptor biology or to develop therapeutic drugs is limited by their lack of selectivity and the poor understanding of mechanisms in ligand-receptor recognition. We addressed these issues by combining chemical and structural biology in research into molecular recognition and inhibitor design. Specifically, the concepts of chemical biology were used to develop synthetically and modularly modified (SMM) chemokines that are unnatural and yet have properties improved over those of natural chemokines in terms of receptor selectivity, affinity, and the ability to explore receptor functions. This was followed by using structural biology to determine the structural basis for synthetically perturbed ligand-receptor selectivity. As a proof-of-principle for this combined chemical and structural-biology approach, we report a novel D-amino acid-containing SMM-chemokine designed based on the natural chemokine called viral macrophage inflammatory protein II (vMIP-II). The incorporation of unnatural D-amino acids enhanced the affinity of this molecule for CXCR4 but significantly diminished that for CCR5 or CCR2, thus yielding much more selective recognition of CXCR4 than wild-type vMIP-II. This D-amino acid-containing chemokine also showed more potent and specific inhibitory activity against HIV-1 entry via CXCR4 than natural chemokines. Furthermore, the high-resolution crystal structure of this D-amino acid-containing chemokine and a molecular-modeling study of its complex with CXCR4 provided the structure-based mechanism for the selective interaction between the ligand and chemokine receptors and the potent anti-HIV activity of D-amino acid-containing chemokines.