An extensive Stokesian dynamics study of the rheological behavior of suspensions of rigid spheres subjected to an oscillating shear strain is presented. Two types of suspensions are considered: (1) rigid spheres in a viscous medium, and (2) rigid spheres in a viscoelastic medium. For this latter system we need to extend the Stokesian dynamics method, which was originally developed by Brady and Bossis for particles suspended in a viscous medium. The derivation of the necessary equations for these extended Stokesian dynamics simulations is given. In this derivation we use the well known correspondence principle and apply it to the set of equations for the hydrodynamic forces and stresslets that are valid for spheres suspended in a viscous medium. Then, using Fourier transformation we obtain differential equations for these forces and stresslets in the viscoelastic case. The contribution of the Brownian motion of the spheres to the bulk stress is found to be independent of the viscoelastic properties of the suspending medium. As an example of a viscoelastic medium we have chosen the Maxwell fluid. In our computer simulations we have calculated both elastic and viscous moduli and compared these results with experimental data. For the case of spheres suspended in a viscous medium we find that the elastic modulus reaches a plateau at high frequencies. Finally we present a simple analytical model which accurately reproduces the hydrodynamic contribution to the viscosity of spheres suspended in a Maxwell medium. This model is used to interpret the experimental results of Aral and Kaylon [Aral, B. K. and D. M. Kaylon, J. Rheol. 41, 599–620 (1977)] that were obtained at Peclet numbers currently inaccessible to Stokesian dynamics simulations.