A new approach to implement a smart ecosystem for freight transportation is proposed. It is aimed to improve efficiency, safety, security and sustainability by including ambient intelligence in both the containers and the infrastructure that supports them. It involves technological as well as organizational and logistic improvements to achieve this goal. The approach is developed in an R+D project named ECOTRANSIT funded by the Spanish MINECO and involving the University of Seville and the Public University of Navarre. The proposal represents a qualitative step beyond existing projects, with innovation in key areas such as logistics and in critical enabling technologies like microelectronics and ICTs.