The role of improving the enforcement of Brazil's Forest Code in reducing deforestation in the Amazon has been highlighted in many studies. However, in a context of strong political pressure for loosening environmental protections, the future impacts of a nationwide implementation of the Forest Code on both environment and agriculture remain poorly understood. Here, we present a spatially explicit assessment of Brazil's 2012 Forest Code through the year 2050; specifically, we use a partial equilibrium economic model that provides a globally consistent national modeling framework with detailed representation of the agricultural sector and spatially explicit land-use change. We test for the combined or isolated impacts of the different measures of the Forest Code, including deforestation control and obligatory forest restoration with or without environmental reserve quotas. Our results show that, if rigorously enforced, the Forest Code could prevent a net loss of 53.4 million hectares (Mha) of forest and native vegetation by 2050, 43.1 Mha (81%) of which are in the Amazon alone. The control of illegal deforestation promotes the largest environmental benefits, but the obligatory restoration of illegally deforested areas creates 12.9 Mha of new forested area. Environmental reserve quotas further protect 5.8 Mha of undisturbed natural vegetation. Compared to a scenario without the Forest Code, by 2050, cropland area is only reduced by 4% and the cattle herd by 8%. Our results show that compliance with the Forest Code requires an increase in cattle productivity of 56% over four decades, with a combination of a higher use of supplements and an adoption of semi-intensive pasture management. We estimate that the enforcement of the Forest Code could contribute up to 1.03 PgCO 2 e to the ambitious GHG emissions reduction target set by Brazil for 2030.