We study a single-unit deteriorating system under condition monitoring for which collected signals are only stochastically related to the actual level of degradation. Failure replacement is costlier than preventive replacement and there is a delay (lead time) between the initiation of the maintenance setup and the actual maintenance, which is closely related to the process of spare parts inventory and/or maintenance setup activities. We develop a dynamic control policy with a two-dimensional decision space, referred to as a warning-replacement policy, which jointly optimizes the replacement time and replacement setup initiation point (maintenance ordering time) using online condition monitoring data. The optimization criterion is the long-run expected average cost per unit of operation time. We develop the optimal structure of such a dynamic policy using a partially observable semi-Markov decision process and provide some important results with respect to optimality and monotone properties of the optimal policy. We also discuss how to find the optimal values of observation/inspection interval and lead time using historical condition monitoring data. Illustrative numerical examples are provided to show thatour joint policy outperforms conventional suboptimal policies commonly used in theliterature.