Small-RNA-mediated chromatin modifications have been widely studied in plants and S. pombe. However, direct evidence of small-RNA-guided sequence-specific chromatin alterations is scarce in animals. In C. elegans, the nuclear RNAi defective (Nrde) pathway functions to transport siRNA from the cytoplasm to the nucleus, modulate transcription elongation, induce histone H3 lysine 9 (H3K9) trimethylation, and mediate transgenerational inheritance of RNAi. Here, we show that both exogenous RNAi and NRDE-bound endogenous 22G RNAs can direct sequence-specific histone H3 lysine 27 (H3K27) trimethylation at targeted loci through the Nrde pathway. The resulting H3K27me3 status can be inherited by progeny for multiple generations. piRNAs and WAGO-1-associated siRNAs induce H3K27 methylation as well. Interestingly, CSR-1-associated endogenous siRNAs fail to trigger H3K27 methylation, whereas exogenous provision of dsRNAs can induce H3K27 methylation at the CSR-1-targeted loci via the Nrde pathway. We further observed distinct genetic requirements of H3K9 and H3K27 trimethylation. Whereas set-25 and met-2 are required for K9 methylation, mes-2 is required for K27 methylation. The depletion of mes-2 leads to a nuclear RNAi defective phenotype. These results indicate that dsRNA-triggered chromatin modification is a sequence-specific response that engages the Nrde pathway in C. elegans.