Radiofrequency (RF) ablation is a minimally invasive therapy for heart arrhythmia including atrial fibrillation (A-fib) by creating lesions to isolate the heart from abnormal electrical signals using an electric current. However, conventional RF procedures do not involve intraoperative monitoring of the area and extent of ablation-induced necrosis, making the assessment of procedure completeness challenging. Previous studies have suggested that spectroscopic photoacoustic (sPA) imaging is capable of differentiating ablated tissue from its non-ablated counterpart based on their PA spectrum variation. Here, we aim to demonstrate the applicability of sPA imaging in an in vivo environment where the cardiac motion presents and introduce a framework for mapping the necrotic lesion based on cardiac-gated sPA imaging. We computed the degree of necrosis (necrotic extent, NE) by taking the fraction of the quantified ablated tissue contrast over the total contrast from both ablated and non-ablated tissues, visualizing it as continuous colormap to highlight the necrotic area and extent. To compensate the tissue motion during a cardiac cycle, we applied the cardiac-gating on sPA data based on the image similarity. The in vivo validation of the concept was conducted in a swine model. As a result, the ablation-induced necrotic lesion at the surface of a beating heart was depicted throughout a cardiac cycle through cardiac-gated sPA (CG-sPA) imaging. The measured necrotic region geometry across the entire cardiac cycle was 6.01 +/- 2.35 mm in width by 1.79 +/- 0.75 mm in depth, which was comparable to the gross pathology with 6.0 mm by 2.9 mm, respectively. The results suggest that the introduced CG-sPA imaging system has the great potential to be incorporated into clinical workflow to guide ablation procedures intraoperatively.