A solar-energy-driven biomass fuel cell for the production of electricity from wastewater using only air and light as additional resources is described. The device consists of a photoelectrochemical cell that contains a nanostructured titanium dioxide or tungsten trioxide film as photoanode and a platinum air electrode as cathode, in separate compartments. The TiO2 or WO3 films are fabricated from TiO2 nanocrystals or from sodium tungstate solutions on top of fluorine-doped tin dioxide. Devices were tested with electrolyte only, synthetic wastewater, or with aqueous glucose solution, under irradiation with sunlight, broad spectral illumination, and monochromatic light. Measured light conversion efficiencies were between 0.007 % and 1.7 %, depending on conditions. The highest efficiency (1.7 %) and power output (0.73 mW cm−2) are determined for TiO2 electrodes under 395 nm illumination. In contrast to TiO2, the WO3 electrodes are active under visible light (>440 nm), but the IPCE value is low (2 %). Apart from limited visible-light absorption, the overall performance of the device is limited by the substrate concentration in the water and by transport resistance through the cell.