The gender achievement gap in mathematics, a key component in science, technology, engineering, and mathematics (STEM) fields, has been widely documented. However, we know little about whether and how the gender gap in math achievement varies by ethnic origin. Using nationally representative data of fourth and ninth graders in Germany, we explore gender and ethnic gaps in math achievement. We measure students’ math achievement using both standardized tests and teacher assessments (i.e., grades). At both educational stages, girls underperform to boys in standardized tests. At comparable levels of competence, no gender differences in math grades are observed in fourth grade, but girls receive better math grades than boys in ninth grade. We also find evidence for ethnic variation in the gender achievement gap at both educational stages. Regarding test scores, the gender difference in math achievement to the disadvantage of girls is larger among Turkish-origin students in fourth grade, and Southern European students in ninth grade. Regarding teacher assessments, we similarly find differences in the gender achievement gap between Turkish-origin and native-born German students. One surprising finding of our study is that, at comparable levels of competence, Turkish-origin boys and MENA students (only in ninth grade) receive better math grades.