Commodity-exporting developing economies are often characterized as having needlessly procyclical fiscal policy: spending when commodity prices are high and cutting back when prices fall. The standard policy advice is instead to save during price windfalls and maintain spending during price busts. This paper questions this characterization and policy advice. Using a New Keynesian model, it finds that optimal fiscal policy is heterogeneous depending on the commodity exported and exchange rate regime. Optimal fiscal policy is often procyclical in countries with floating exchange rates because many commodity price shocks are highly persistent, and so they should be spent according to the permanent income hypothesis. In contrast, in countries with fixed exchange rates, optimal fiscal policy becomes countercyclical to smooth the business cycle. Empirically, the paper introduces a new measure of fiscal cyclicality, the marginal propensity to spend (MPS) an extra dollar of commodity revenues, and shows that it is moderately procyclical overall but highly heterogeneous across countries depending on their characteristics. Consistent with theory, the MPS is more procyclical in countries with floating exchange rates than those with fixed exchange rates. Moreover, in countries with floating exchange rates, the MPS is higher in countries facing more persistent commodity price shocks.