In this paper we show how the marginal-cost approach can be used to optimise multi-parameter replacement rules. We will illustrate this for an opportunity-based age replacement rule that consists of two parameters. The first parameter is a control limit t, which indicates from what age on a unit is replaced preventively at the first arising opportunity. The second parameter is a planned replacement age T, which indicates at what age the unit is replaced if it has not been replaced yet. The unit can fail and is immediately replaced upon failure. It can be shown that this replacement rule belongs to a class of policies for which the long-run average-cost function is unimodal. The marginal cost approach is based on the following assertion: any point, in which the marginal cost(s) of deferring maintenance equals the average-cost, is an average-cost minimum. Assuming unimodality the minimisation problem can be solved as a root-finding problem, for which there are numerous efficient routines. It appears that the marginal cost approach is very practical for the optimisation of the considered replacement rule, especially because a quick assessment can be made of the optimal parameter values. The marginal cost approach can be used for many other multi-parameter problems, insofar as they can be modelled as a regenerative process.