In most more economically developed countries an ever growing percentage of existing structures is threatened by obsolescence in the short-to medium-term-either because of structural deficits due to deterioration, or due to functional aging. To ensure sustained serviceability and safety of these structures, maintenance interventions are utilized, which allow partial or complete structural rehabilitation. However, such maintenance interventions have to be economically reasonable, that is, maintenance expenditures spent have to be outweighed by expected future benefits. For this purpose, we propose herein a novel optimization formulation for maintenance planning based on cost-benefit criteria. The usefulness of the proposed approach lies in the fact, that it not only allows to determine optimal sequences of maintenance times, rehabilitation levels and inspection qualities, but also allows to specify economically optimal lifetimes and acceptable failure rates of structures. The modeling of structural deterioration and maintenance, as well as the setting of all relevant cost factors is discussed in detail. Numerical examples investigate the effect of imperfect execution of maintenance actions and functional aging.