In this paper we are mainly concerned with nontrivial positive solutions to the Dirichlet problem for the degenerate elliptic equation \begin{gather} -\frac{\partial^2 u}{\partial x^2} -\left|x\right|^{2k}\frac{\partial^2 u}{\partial y^2}=|x|^{2k}u^p+f(x,y,u) \quad\text{ in }\Omega, \ u=0 \quad\text{ on }\partial\Omega,\label{equ0} \end{gather} where \(\Omega\) is a bounded domain with smooth boundary in \(\mathbb{R}^2, \Omega \cap \{x=0\}\ne \emptyset,\) \(k\in\mathbb N,\) \(f(x,y,0)=0,\) and \(p=(4+5k)/k\) is the critical exponent. Recently, the equation (1) was investigated in [12] for the subcritical case based on a new result obtained in [17] on embedding theorem of weighted Sobolev spaces. In the critical case considered in this paper we will essentially use the optimal functions and constants found in [17]