In this paper, a computational study of natural convection in a grooved enclosure filled with water-based nanofluid in the presence of external magnetic field is numerically investigated. Two-component non-homogeneous model is introduced to develop the governing partial differential equations. Galerkin finite element method is used to solve the governing equations. The computation is carried out for a wide range of governing parameters such as Rayleigh number (10 3 ≤ Ra ≤ 10 6), magnetic field parameter (10 ≤ Ha ≤ 100) and volume fraction of nanoparticles (0% ≤ ϕ ≤ 5%) with fixed values of remaining parameters. A detailed parametric analysis is performed to show the effects of physical parameters on the fluid flow and temperature distributions within the enclosure via streamlines, isotherms, isoconcentrations, midsectional velocities, average Nusselt number and temperature, respectively. In addition, the entropy generation and Bejan number are also computed and discussed elaborately. The results of the current study are compared to those of previous numerical and experimental studies and found to be in rational agreements. The results ascertain that the average Nusselt number and entropy generation increase with rising Rayleigh number and nanoparticle volume fraction, whereas they decrease with increasing magnetic field strength. Moreover, it is found that the appropriate combination of governing parameters can maximize the heat transfer rate and minimize the entropy generation as well.