Direct energy consumption in the urban environment accounts for 10-25% of the total global energy consumption. Taking up only 2% of the global area, cities are subject to urban planning that promotes energy efficiency and CO2 emissions mitigation. This study aims to evaluate the effect of urban planning actions, which affect the urban environment, on energy consumption and emissions. Based on characteristics of Brazilian cities (climate, energy, income distribution), we have proposed an agent based model and 64 distinct initial settings, which combine land use, introduction of green areas, and the decentralization of industries and services (attraction points). We have realized that maximizing land use increases urban density from 11,000 to 18,000 inhabitants/km2, which enhances the heat island effect, and implies in up to 20% more energy consumption due to increasing air conditioning and lift needs. The mitigation of the heat island effect by means of green areas affects trip distances and increases energy consumption by 8.5%. The decentralization of attraction points creates a multi centered city, which decreases trip distances and reduces energy consumption by 10%, independently of the other variables. Regarding emissions, the urban environment allows for the use of more efficient technologies and renewable energy sources. In order to evaluate the impact on CO2 emissions, we have simulated changes in energy supply - natural gas versus LPG - and technologies - solar versus electric versus natural gas water heating. The results demonstrate that substitution of LPG for natural gas for cooking reduces total emissions by 3%. The penetration of natural gas, displacing electric shower heating reduces total emissions by 3%, whereas the adoption of solar heating by all city dwellers reduces total direct emissions by 11,5%. The full adoption of natural gas for cooking and solar power for heating implies in 17% of CO2 emissions reduction. Consequently, city characteristics affect direct energy consumption and emissions, and therefore, urban planning and city management are decisive tools for energy management, and the pursuit of sustainability.