This Letter is concerned magnetohydrodynamic (MHD) boundary layer flow of an upper-convected Maxwell (UCM) fluid over a porous stretching sheet. By means of similarity transformations, the non-linear equations governing the flow under discussion are reduced to an ordinary differential equation. With the help of homotopy analysis method (HAM), the analytical solution is obtained in the series form. Convergence of the series is explicitly discussed. The effects of various involved parameters of interest are shown on velocity and skin friction coefficient for both suction and injection.