The quake struck at 11.34pm on Tuesday (2034 AEST) at a depth of 10 kilometres, seven kilometres southwest of Christchurch, the US Geological Survey said.
New Zealand's GeoNet monitoring service said it was felt across the city, which has suffered three major quakes in the past nine months, including a 6.0 tremor on June 13 and a devastating 6.3 quake in February that killed 181 people.
Police said there were no reports of major damage after the latest scare, although the Christchurch Press and Radio New Zealand said power supplies were cut in a number of suburbs.
Christchurch airport said its terminal was evacuated after the tremor and runways were being inspected for damage.
The airport also closed briefly after the June 13 quake but reopened after a few hours.
Christchurch resident Farhad Dastgheib told the Christchurch Press that the quake had pushed his bed around violently.
"We heard a rumble and thought 'Not again'," Dastgheib said.
"It didn't last as long as last Monday's quake but still felt scary. The aftershocks keep coming."
Radio talkshow caller Michael told Newstalk ZB "it was a bit like being on a small boat in waves, but not at a high level".
He said quake-weary residents of New Zealand's second largest city were stressed from the constant aftershocks, describing living in Christchurch as "purgatory".
"We do not know when the next one's coming, it's a recipe for people to collapse," he said.GeoNet reported further aftershocks measuring 3.5 and 3.6 in the hour after the 5.1 shake.