An optimal repair/replacement problem for a single-unit repairable system with minimal repair and random repair cost is considered. The existence of the optimal policy is established using results of the optimal stopping theory, and it is shown that the optimal policy is a ‘repair-cost-limit’ policy, that is, there is a series of repair-cost-limit functions gn(t), n = 1, 2,…, such that a unit of age t is replaced at the nth failure if and only if the repair cost C(n, t) ≥ gn(t); otherwise it is minimally repaired. If the repair cost does not depend on n, then there is a single repair cost limit function g(t), which is uniquely determined by a first-order differential equation with a boundary condition.