The goal of this study was to explore longitudinally the protective role of relationships with early childhood and education care (ECEC) teachers for shy children’s social functioning at age 5 and 8 years. Participants were N = 7343 children from the Norwegian Mother, Father and Child (MoBa) study, a prospective longitudinal cohort study in Norway. Measures included maternal rating of child shyness at age 18 months, 3 and 5 years, ECEC teacher ratings of teacher–child relationships and maternal ratings of child peer play behaviors at age 5 years, and teacher ratings of child social competence at age 8 years. We conducted latent moderated-mediation analyses within a SEM framework. Among the results, childhood shyness was negatively associated with social functioning. However, significant indirect and moderation effects were also found, with a pattern suggesting that early positive teacher–child relationships have a buffering influence on shy children’s risk for social difficulties.