The influence of elasticity, inertia and modulation on the Taylor–Couette flow with spatially modulated cylinders is examined for an Oldroyd-B fluid. Only the inner cylinder rotates, but one or two cylinders can be modulated. The modulation of the cylinders is periodic and the modulation amplitude is assumed to be small. A regular perturbation expansion is used to determine the flow field at small to moderately large Taylor and elasticity numbers. The flow is assumed to be axisymmetric and only the steady state is studied. For a Newtonian fluid, the increase in inertia leads to an intensification of the secondary (Taylor-vortex) flow, but the vortex structure and number remain unchanged as Ta increases, regardless of the type of modulation. Fluid elasticity, for both weakly and strongly elastic fluids, is found to alter significantly the vortex structure. When the outer cylinder is modulated, fluid elasticity is found to intensify the flow to a maximum level at an elasticity number E = E max, at which point the vortices are “squeezed” toward the inner cylinder, resulting in the weakening of the secondary flow as E is further increased beyond E max. When only the inner cylinder is modulated, two additional vortices appear, originating at the outer cylinder. In this case, the flow intensity exhibits a minimum as E is varied. The combined effect of inner- and outer-cylinder modulation has also been examined. Finally, there is an optimal modulation wavenumber for which the secondary vortex structure is best visible.