In the US economy, Black men, on average, receive lower wages than White men, and the difference increases over the working life. The employment rate and the number of hours worked are also lower for Blacks, but the gap is nearly constant. Together these facts suggest that on-the-job human capital accumulation might explain the diverging wages. However, the wage gap and its evolution over the lifecycle cannot be explained by differences in accumulated experience or educational attainment for the cohort we analyze. Instead, the combination of experience and test scores measured at ages 17-22 accounts for the wage gap and its growth. We propose an on-the-job human capital accumulation model with heterogeneity in the initial human capital endowment and the lifelong ability to accumulate human capital, and endogenous labor supply at the extensive and intensive margins to explain the evolution of the Black-White wage gap over the lifecycle. We discipline the distribution of the ability to accumulate human capital using the power of test scores to predict earnings growth in the data. We find that if the pre-market distributions were the same for Blacks and Whites, the racial gap in hourly earnings would be closed by 84%, with the remaining gap opening throughout life due to higher labor supply amongst White men. That is, the unequal conditions with which men in the two groups enter the labor market are likely to be the key determinant of the differences over the lifecycle.