Networked microgrids (MGs) have a great potential to improve the efficiency, reliability, resilience, security, and sustainability of power supply services. Peer-to-peer (P2P) energy trading built on a smart information system in networked MGs is an emerging economic approach to facilitate energy sharing among networked MGs to achieve mutual cost-effective operation and improve the reliability and stability of energy supply service. Such a distributed and competitive energy trading market urges the need for an efficient energy trading strategy that incentivizes the self-interested MGs with various energy production and consumption profiles to participate in energy trading. In this paper, we propose a distributed real-time P2P energy trading strategy that integrates energy trading into energy management and enables the MGs with renewable energy sources (RESs) and energy storage systems (ESSs) to manage their storage scheduling, energy supply, and energy trading in a dynamic manner, jointly considering the randomness of renewable energy generation and load demand, operational constraints of ESSs and transmission losses associated with energy exchange. The proposed energy control and bidding algorithm allows each MG to dynamically and independently determine its energy control actions and price-quantity bids/offers, while the proposed trading pair matching algorithm matches the MGs on a many-to-many basis with respect to their individual payoffs, which couple price-quantity bids/offers of the MGs with distance-dependent energy transmission losses associated with energy exchange. Numerical simulation results demonstrate that the proposed distributed energy trading system yields significant improvements in terms of energy cost savings and renewable energy utilization efficiency, while reducing energy transmission losses within the system.