Policy makers are increasingly tying payments for health care providers to their performance on quality measures, though there is little empirical evidence to guide the design of such incentives. I deploy administrative Medicare claims data to study a large federal program which penalizes hospitals with high rates of repeat hospitalizations (“readmissions”). I exploit the introduction of the penalty and policy-driven variation in penalty across hospitals to identify the effect of the program on hospital admission and treatment decisions, and on patient health. The program is associated with a 5% decrease in readmission accompanied by a 3% reduction in thirty day mortality.I quantify the role of two mechanisms - improvement in treatment quality and changes in admitting behavior - and find that quality improvement can explain 55-60% of the aggregate decrease. The change in admitting behavior seems driven by the penalty since there is a substantial decrease in admission rate for returning patients that could potentially incur a penalty but no such effect for those that will not. It plays a quantitatively important role and I find suggestive evidence of harm to affected patients.