Costa Rica lies above the convergent plate boundary where the Cocos Plate is subducting beneath the Caribbean Plate at a rate of 9 cm per year.
The same area was struck by a M7.7 earthquake in 1950 but had been quiet before the recent earthquake, and the segment of the plate boundary was known as the Nicoya Peninsula seismic gap.