Spontaneous toroidal rotation of impurity ions has been observed in the core of Alcator C-Mod plasmas with no external momentum input. The magnitude of the rotation ranges from -60 km/s (countercurrent) in limiter L-mode discharges to +140 km/s (cocurrent) in ion cyclotron range of frequencies-heated H-mode plasmas. The core rotation in L-mode plasmas is generally countercurrent and is found to depend strongly on the magnetic topology; in near double null discharges, the core rotation changes by 25 km/s with a variation of a few millimeters in the distance between the primary and secondary separatrices. In H-mode plasmas, the rotation increments in the cocurrent direction with the toroidal rotation velocity increase proportional to the corresponding stored energy increase, normalized to the plasma current. These discharges exhibit a positive Er in the core. Immediately following the transition from L-mode into enhanced D (EDA) H-mode, the cocurrent rotation appears near the plasma edge and propagates to the center on a time scale similar to the energy confinement time but much less than the neoclassical momentum diffusion time, indicating both the role of the plasma boundary in the dynamics of the H-mode transition and the anomalous nature of momentum transport. Rotation velocity profiles are flat in EDA H-mode plasmas and centrally peaked for edge-localized mode-free H-modes, demonstrating the effects of an inward momentum pinch. In EDA H-mode discharges that develop internal transport barriers, the core toroidal rotation inside the barrier foot is observed to drop on a time scale similar to the core pressure profile peaking (hundreds of milliseconds), indicating a negative Er well in the core region.