Given the recent empirical evidence on peer effects in CEO compensation, this paper theoretically examines how relative wealth concerns, in which a manager's satisfaction with his own compensation depends on the compensation of other managers, affect the equilibrium contracting strategy and managerial risk-taking. We find that such externalities can generate pay-for-luck as an efficient compensation vehicle in equilibrium. In expectation of pay-for-luck in other firms, tying managerial pay to luck provides insurance to managers against a compensation shortfall relative to executive peers during market fluctuations. When all firms pay for luck, we show that an effort-inducing mechanism exists: managers have additional incentives to exert effort in utilizing investment opportunities, which helps them keep up with their peers during industry movements.In addition, we show that compensation arrangements involving pay-for-luck that are efficient from the shareholders' perspective can nonetheless exacerbate aggregate fluctuations in the real economy by incentivizing excessive systemic risk-taking, especially in periods of heightened risk.