This paper deals with the limit cycles of a class of cubic Hamiltonian systems under polynomial perturbations. We suppose that the corresponding Hamiltonian system which has at least one center has finite singular points and is symmetrical with respect to both x-axis and y-axis, and also the origin is a nilpotent singular point. Hence, the Hamiltonian H(x,y) can be written asH(x,y)=−x2+(ax4+bx2y2+cy4), (a,b,c)∈R3,c≠0. For the above H(x,y), the corresponding vector field isx˙=2y(bx2+2cy2),y˙=2x(1−2ax2−by2). We first obtain that the above vector fields with at least one center can be divided into 8 classes by its topological phase portraits. For the following perturbed systemx˙=2y(bx2+2cy2)+εf(x,y),y˙=2x(1−2ax2−by2)+εg(x,y), where 0<|ε|≪1, f(x,y) and g(x,y) are polynomials in (x,y) with degree n, we give an estimation of the number of isolated zeros of the corresponding Abelian integral. The number of limit cycles follows from Poincaré–Pontryagin Theorem.