The rise of distributed generation makes more difficult the power balance between demand and generation in electrical networks, especially by the uncertainty of renewable generation. Smart grid concepts have been developed to solve this problem. A set of generators, loads and storage devices are locally managed to minimize the energy cost. These smart grids have surpluses and deficits of energy along time, so they have to interact in a local smart market. In this paper, we present a local smart market based on a multi-agent system. Every smart grid has a manager agent that minimizes its energy cost (intra-market). Then, it offers the surplus of energy or requests the deficit of energy to other neighbour smart grids. An auction allows fixing the energy and economical interchange among smart grids (inter-market). The manager agent can buy energy in the auction when it is cheaper than the energy of their own generators even if these generators have surplus of energy. A Multi-agent system has been developed in JADE platform.