Abstract A numerical study is presented for magnetohydrodynamic free convection of an electrically conducting fluid in a shallow cavity heated from below and cooled from above. The side walls are maintained adiabatic. A uniform magnetic field, inclined with an angle 0 with respect to the horizontal plane, is externally imposed. The investigation covers the range of the Rayleigh number, Ra, from 1.8 × 103 to 3 x 104the Hartmann number, Ha, from 0 to 35, the Prandtl number, Pr, from 0.005 to 1 and aspect ratio of the cavity, A = 6. The effect of the magnetic field on the flow structure is presented. For supercritical convection it is found that, upon increasing Ha, the number of roll cells in the cavity increases when it is perpendicular to it. The imposition of an inclined magnetic field gives rise to new flow patterns with tilted lateral cell walls. The effect of both strength and orientation of the magnetic field on the overall heat transfer is found to be significant.