We present an intertemporal portfolio choice model where individuals invest in financial literacy, save, allocate their wealth between a safe and a risky asset, and receive a pension when they retire. Financial literacy affects the excess return from and cost of stock-market participation. Investors simultaneously choose how much to save, their portfolio allocation, and the optimal investment in financial literacy. The model implies that one should observe a positive correlation between stock-market participation (and risky asset share, conditional on participation) and financial literacy, and a negative correlation between the generosity of the social security system and financial literacy. The model also implies that financial literacy accumulated early in life is positively correlated with the individual's wealth and portfolio allocations in later life. Using microeconomic cross-country data, we find support for these predictions.