The swimming of a spheroid immersed in a viscous fluid and performing surface deformations periodically in time is studied on the basis of Stokes equations of low Reynolds number hydrodynamics. The average over a period of time of the swimming velocity and the rate of dissipation are given by integral expressions of second order in the amplitude of surface deformations. The first order flow velocity and pressure, as functions of spheroidal coordinates, are expressed as sums of basic solutions of Stokes equations. Sets of superposition coefficients of these solutions which optimize the mean swimming speed for given power are derived from an eigenvalue problem. The maximum eigenvalue is a measure of the efficiency of the optimal stroke within the chosen class of motions. The maximum eigenvalue for sets of low order is found to be a strongly increasing function of the aspect ratio of the spheroid.