AbstractWe show that some Emden–Fowler (EF) equations encountered in astrophysics and cosmology belong to two EF integrable classes of the type ${\mathrm{d}^{2}}z/\mathrm{d}{\chi^{2}}=A{\chi^{-\lambda-2}}{z^{n}}$ for $\lambda=(n-1)/2$ (class 1), and $\lambda=n+1$ (class 2). We find their corresponding invariants which reduce them to first-order nonlinear ordinary differential equations. Using particular solutions of such EF equations, the two classes are set in the autonomous nonlinear oscillator the form ${\mathrm{d}^{2}}\nu/\mathrm{d}{t^{2}}+a\mathrm{d}\nu/\mathrm{d}t+b(\nu-{\nu^{n}})=0$, where the coefficients $a,b$ depend only on $\lambda,n$. For both classes, we write closed-form solutions in parametric form. The illustrative examples from astrophysics and general relativity correspond to two n = 2 cases from class 1 and 2, and one n = 5 case from class 1, all of them yielding Weierstrass elliptic solutions. It is also noticed that when n = 2, the EF equations can be studied using the Painlevé reduction method, since they are a particular case of equations of the type ${\mathrm{d}^{2}}z/\mathrm{d}{\chi^{2}}=F(\chi){z^{2}}$, where $F(\chi)$ is the Kustaanheimo-Qvist function.