An intracardiac pacemaker is configured to filter a raw cardiac electrical signal received by the pacemaker to produce a filtered cardiac electrical signal, analyzes the filtered cardiac electrical signal to establish cardiac event sensing criteria that discriminate P-waves from T-waves and R-waves all present in the raw cardiac electrical signal, and sense the P-waves from the filtered cardiac electrical signal when the established cardiac event sensing criteria are met. Sensed P-waves may be used for controlling atrial-synchronized ventricular pacing delivered by the pacemaker.