This paper develops a framework for estimation and inference to analyze the effect of a policy or treatment in settings with treatment effect heterogeneity and variation in treatment timing. We propose a two-stage estimator that compares treated and untreated outcomes after removing group and period effects identified from a regression using untreated observations. Our regression-based approach enables us to conduct inference within a conventional GMM asymptotic framework. It easily facilitates fairly standard extensions such as estimating dynamic treatment effects and triple differences; incorporating time-varying controls, individual unit fixed effects, and different approaches to testing parallel trends; and considering violations of the parallel trends assumption. To understand the finite sample properties of our estimator, we conduct simulations of randomly generated laws in state-level wage data, extending the "placebo law" analysis of Bertrand, Duflo, and Mullainathan (2004) to a setting with heterogeneous treatment effects and staggered treatment timing. Our method outperforms alternative approaches for estimation and inference based on precision and rejection rates. Even with homogeneous treatment effects, our approach yields similar standard errors as two-way fixed effects regressions, unlike other proposed heterogeneity-robust estimators. Across seven empirical applications, we compare the relative performance of the different methods by analyzing the rate of extreme t-statistics and outlying standard errors relative to one another. Our two-stage approach thus stands out as a practical choice for applied researchers.