Detection and delineation of P- and T-waves are important issues in the analysis and interpretation of electrocardiogram (ECG) signals. This paper addresses this problem by using Bayesian inference to represent a priori relationships among ECG wave components. Based on the recently introduced partially collapsed Gibbs sampler principle, the wave delineation and estimation are conducted simultaneously by using a Bayesian algorithm combined with a Markov chain Monte Carlo method. This method exploits the strong local dependency of ECG signals. The proposed strategy is evaluated on the annotated QT database and compared to other classical algorithms. An important feature of this paper is that it allows not only for the detection of P- and T-wave peaks and boundaries, but also for the accurate estimation of waveforms for each analysis window. This can be useful for some ECG analysis that require wave morphology information.