We present a first-principles method for the calculation of optical excitations in nanosystems.The method is based on solving the Bethe-Salpeter equation (BSE) for neutral excitations. The electron self-energy is evaluated within the GW approximation, with dynamical screening effects described within time-dependent density-functional theory in the adiabatic, local approximation.This method is applied to two systems: the benzene molecule, C 6 H 6 , and azobenzene, C 12 H 10 N 2 .We give a description of the photoisomerization process of azobenzene after an n − π ⋆ excitation, which is consistent with multi-configuration calculations.