The harvesting of mechanical energy from ambient sources could power electrical devices without the need for batteries. However, although the efficiency and durability of harvesting materials such as piezoelectric nanowires have steadily improved, the voltage and power produced by a single nanowire are insufficient for real devices. The integration of large numbers of nanowire energy harvesters into a single power source is therefore necessary, requiring alignment of the nanowires as well as synchronization of their charging and discharging processes. Here, we demonstrate the vertical and lateral integration of ZnO nanowires into arrays that are capable of producing sufficient power to operate real devices. A lateral integration of 700 rows of ZnO nanowires produces a peak voltage of 1.26 V at a low strain of 0.19%, which is potentially sufficient to recharge an AA battery. In a separate device, a vertical integration of three layers of ZnO nanowire arrays produces a peak power density of 2.7 mW cm(-3). We use the vertically integrated nanogenerator to power a nanowire pH sensor and a nanowire UV sensor, thus demonstrating a self-powered system composed entirely of nanowires.