In this paper, a peer-to-peer (P2P) renewable energy trading mechanism for microgrids when energy suppliers are equipped with storage devices is studied. A dynamic energy storage management strategy based on the local trading price is proposed and each supplier decides the amount of energy to be sold and stored in real time. An iterative auction algorithm is presented to obtain the market equilibrium and optimal energy allocation schedule. The economic analysis of introducing energy storage devices in this trading market is further studied. Numerical examples of two 7 × 24-h energy trading scenarios with 20 consumers and 20 solar energy producers are used to illustrate the feasibility of this proposed trading mechanism, with sensitivity analysis of different parameters on social welfare. A comparison of the hourly optimal local trading price of these two markets is demonstrated to explain the dynamic process. It is found that in those days with high solar radiation, compared with the market with no storage device, the total cost for buyers in the market when storage devices are used shows a decline of 1.52% and the total profit for sellers shows an increase of 1.27%, which leads to a substantial relative improvement of 118.94% in the overall social welfare. Moreover, a brief economic analysis shows that the advantage of using energy storage in this example is guaranteed after five years of operation. Longer operation time does not mean more benefits considering the deterioration of battery packs and increase of operation and maintenance costs, and the profit reaches its maximum value at the 15th year.