This study considers the steady flow of a viscous, incompressible and electrically conducting fluid in a lid‐driven square cavity under the effect of a uniform horizontally applied magnetic field. The governing equations are obtained from the Navier‐Stokes equations including buoyancy and Lorentz force terms and the energy equation including Joule heating and viscous dissipation terms. These equations are solved iteratively in terms of velocity components, stream function, vorticity, temperature, and pressure by using radial basis function approximation. Particular solution, which is approximated by radial basis functions to satisfy both differential equation and boundary conditions, becomes the solution of the differential equation itself. Vorticity boundary conditions are obtained from stream function equation using finite difference scheme. Normal derivative of pressure is taken as zero on the boundary. The numerical results are obtained for several values of Hartmann number and Grashof number for the Stokes approximation (Re << 1). The results show that when the viscous dissipation is present, the flow and isolines concentrate through the cold wall forming boundary layers as Grashof number increases. An increase in the magnetic field intensity retards the effect of buoyancy force in the square cavity, whereas the movement of the upper lid causes buoyancy force to be dominant. The solution is obtained in a considerably low computational expense through the use of radial basis function approximations for the MHD equations. Copyright © 2017 John Wiley & Sons, Ltd.