Puccinia striiformis f. sp. tritici is the causal agent of wheat stripe rust that causes severe yield losses all over the world. As a macrocyclic heteroecious rust fungus, it is able to infect two unrelated host plants, wheat and barberry. Its urediniospores infect wheat and cause disease epidemic, while its basidiospores parasitize barberry to fulfill the sexual reproduction. This complex life cycle poses interesting questions on the different mechanisms of pathogenesis underlying the infection of the two different hosts. In the present study, transcriptomes of P. striiformis f. sp. tritici during the initial infection of wheat and barberry leaves were qualitatively and quantitatively compared. As a result, 142 wheat-specifically expressed genes (WEGs) were identified, which was far less than the 2,677 barberry-specifically expressed genes (BEGs). A larger proportion of evolutionarily conserved genes were observed in BEGs than that in WEGs, implying a longer history of the interaction between P. striiformis f. sp. tritici and barberry. Additionally, P. striiformis f. sp. tritici differentially expressed genes (DEGs) between wheat at 1 and 2 days postinoculation (dpi) and barberry at 3 and 4 dpi were identified by quantitative analysis. Gene Ontology analysis of these DEGs and expression patterns of P. striiformis f. sp. tritici pathogenic genes, including those encoding candidate secreted effectors, cell wall–degrading enzymes, and nutrient transporters, demonstrated that urediniospores and basidiospores exploited distinct strategies to overcome host defense systems. These results represent the first analysis of the P. striiformis f. sp. tritici transcriptome in barberry and contribute to a better understanding of the evolutionary processes and strategies of different types of rust spores during the infection process on different hosts.