We empirically examine two competing views of CEO pay. In the contracting view, pay is used to solve an agency problem: the compensation committee optimally chooses pay contracts which give the CEO incentives to maximize shareholder wealth. In the skimming view, pay is the result of an agency problem: CEOs have managed to capture the pay process so that they set their own pay, constrained somewhat by the availability of cash or by a fear of drawing shareholders' attention. To distinguish these views, we first examine how CEO pay responds to luck, observable shocks to performance beyond the CEO's control. Using several measures of luck, such as changes in oil price for the oil industry, we find substantial pay for luck. Pay responds about as much to a lucky' dollar as to a general dollar. Most importantly, we find that better governed firms pay their CEOs less for luck. Our second test examines how much CEOs are charged for the options they are granted. Since options never appear on balance sheets, they might offer an appealing way to skim. Here again we find a crucial role for governance: CEOs in better governed firms are charged more for the options they are given. These results suggest that both views of CEO pay matter. In poorly governed firms, the skimming view fits better (pay for luck and little charge for options) while in well governed firms, the contracting view fits better (filtering out of luck and charging for options).