PurposeIn the present computational study, the heat transfer and two-dimensional natural convection flow of non-Newtonian power-law fluid in a tilted rectangular enclosure is examined. The left wall of enclosure is subjected to spatially varying sinusoidal temperature distribution and right wall is cooled isothermally while the upper and lower walls are retained to be adiabatic. The flow is considered to be laminar, steady and incompressible under the influence of magnetic field. The governing mass, momentum and energy equations are transformed into dimensionless form in terms of stream function, vorticity and temperature.Design/methodology/approachThen resulted highly non-linear partial differential equations are solved computationally using Galerkin finite element method.FindingsThe exhaustive flow pattern and temperature fields are displayed through streamlines and isotherm contours for various parameters, namely, Prandtl number, Rayleigh number, Hartmann number by considering different power-law index and inclination angle. The effect of inclination angle on average Nusselt number is also shown graphically. This problem observes the potential vortex flow with elliptical core. The results show that the circular strength of the vortex formed reduces as the magnetic field strength grows. As the inclination angle increases the intensity of flow field decreases while the value of average Nusselt number increases.Originality/valueThis study has important applications in thermal management such as cooling techniques used in buildings, nuclear reactors, heat exchangers and power generators.