The decarbonization of city energy systems plays an important role to meet climate targets. We examine the consequences of integrating electric cars and buses into the city energy system (60% of private cars and 100% of public buses), using three different charging strategies in a modelling tool that considers local generation and storage of electricity and heat, electricity import to the city, and investments to achieve net-zero emissions from local electricity and heating in 2050. We find that up to 85% of the demand for the charging of electric cars is flexible and that smart charging strategies can facilitate 62% solar PV in the charging electricity mix, compared to 24% when cars are charged directly when parked. Electric buses are less flexible, but the timing of charging enables up to 32% to be supplied by solar PV. The benefit from smart charging to the city energy system can be exploited when charging is aligned with the local value of electricity in the city. Smart charging for cars reduces the need for investments in stationary batteries and peak units in the city electricity and heating sectors. Thus, our results point to the importance of sectoral coupling to exploit flexibility options in the city electricity, district heating and transport sectors