In a continuous-time framework, we consider the problem of a Defined Contribution Pension Fund in the presence of a minimum guarantee. The problem of the fund manager is to invest the initial wealth and the (stochastic) contribution flow into the financial market, in order to maximize the expected utility function of the terminal wealth under the constraint that the terminal wealth must exceed the minimum guarantee. We assume that the stochastic interest rates follow the affine dynamics, including the Cox–Ingersoll–Ross (CIR) model [Econometrica 53 (1985) 385] and the Vasiček model. The optimal investment strategies are obtained by assuming the completeness of financial markets and a CRRA utility function. Explicit formulae for the optimal investment strategies are included for different examples of guarantees and contributions.