The steady nonlinear hydromagnetic flow of an incompressible, viscous and electrically conducting fluid with heat transfer over a surface of variable temperature stretching with a power-law velocity in the presence of variable transverse magnetic field is analysed. Utilizing similarity transformation, governing nonlinear partial differential equations are transformed to nonlinear ordinary differential equations and they are numerically solved using fourth-order Runge–Kutta shooting method. Numerical solutions are illustrated graphically by means of graphs. The effects of magnetic field, stretching parameter and Prandtl number on velocity, skin friction, temperature distribution and rate of heat transfer are discussed.