By employing local renewable energy sources and power generation units while connected to the central grid, microgrid can usher in great benefits in terms of cost efficiency, power reliability, and environmental awareness. Economic dispatching is a central problem in microgrid operation, which aims at effectively scheduling various energy sources to minimize the operating cost while satisfying the electricity demand. Designing intelligent economic dispatching strategies for microgrids, however, is drastically different from that for conventional central grids, due to two unique challenges. First, the erratic renewable energy emphasizes the need for online algorithms. Second, the widely-adopted peak-based pricing scheme brings out the need for new peakaware strategy design. In this paper, we tackle these critical challenges and devise peak-aware online economic dispatching algorithms. For microgrids with fast-responding generators, we prove that our deterministic and randomized algorithms achieve the best possible competitive ratios 2 − β and e/(e − 1 + β), respectively, where β ∈ [0, 1] is the ratio between the minimum grid spot price and the localgeneration price. Our results characterize the fundamental price of uncertainty of the problem. For microgrids with slow-responding generators, we first show that a large competitive ratio is inevitable. Then we leverage limited prediction of electricity demand and renewable generation to improve the competitiveness of the algorithms. By extensive empirical evaluations using real-world traces, we show that our online algorithms achieve near offline-optimal performance. In a representative scenario, our algorithm achieves 23% and 11% cost reduction as compared to the case without local generation units and the case using peak-oblivious algorithms, respectively.