Former research has highlighted the relevance of basic psychological need (BPN) satisfaction for students' academic motivation and achievement. However, the specific role of self-efficacy in this relationship has been neglected. Using survey response data from a sample of 2,359 German middle school students in 35 schools, we employed Hierarchical Linear Modeling to investigate the role of teacher support for students' perceived BPN, academic self-efficacy, and autonomous and controlled motivation on student achievement in two subjects (mathematics, German). We found that self-efficacy had the largest relationship with achievement and it mediated the effect of autonomous motivation on grades while controlled motivation had a small and statistically significant, negative relationship regardless of self-efficacy. Support of students' perceived BPN had a postive statistically signficant association with autonomous motivation. Motivation and self-efficacy also mediated perceived BPN support and achievement. Self-efficacy had a statistically signficant association and had a reciprocal relationship with both autonomous and controlled motivation. The findings indicate that self-efficacy plays a major role in the relationships among perceived BPN support, motivation, and academic achievement, and highlight the importance of supporting student self-efficacy in academic settings.