Authorities declared an overnight curfew for Saturday after a major earthquake hit New Zealand's second biggest city, Christchurch, bringing down power lines and bridges and wrecking roads and building facades.
"The damages are incredibly frightening. The only thing you can say it's a miracle that no one lost their life," Prime Minister John Key told Television NZ after the quake struck with a magnitude of 7.1 from a depth of 10 kms (6 miles) at around 4.35 a.m. local time (1635 GMT Friday).
He said early estimates for the cost of repairs were around NZ$2 billion ($1.4 billion).
A curfew was slapped on the central business district of Christchurch between 1900 and 0700 (0700 GMT and 1900 GMT). Earlier, a formal civil defence state of emergency was imposed in the city of around 350,000 to coordinate recovery operations.
The last time authorities declared a local emergency was in late December 2007 when a 6.8 magnitude earthquake hit Gisborne on New Zealand's North Island. The earthquake caused damage to some buildings but also caused no casualties.
Christchurch city and the neighboring small towns bore the full force of the quake, which did considerable damage to infrastructure.
"The damage is immense, it's something that has affected every family, every household...the hit on our infrastructure, the pipes that deliver the water, the waste water, the bridges, the power supplies...has been very significant," Christchurch mayor Bob Parker told reporters.
The city's hospital said two men had been admitted with serious injuries, one hit by a falling chimney and the other cut by glass.
Police said there were minor instances of looting, which had been quickly contained. In the suburbs many houses had broken windows, toppled chimneys, cracked walls and items thrown off shelves, with some streets and footpaths subsiding.
In late afternoon, power has been restored to 90 percent of the Christchurch urban area and 80 percent of the rural network.
Authorities were preparing to bring in water in large tankers because pumping stations were out of action and pipes broken.
"We're all feeling scared - we've just had some significant aftershocks," he told TV One News. "Tonight we're just people in the face of a massive natural disaster, trying to help each other ... and we're grateful we haven't lost a life."
State geological agency GNS Science reported 29 aftershocks in the 14 hours following the quake, ranging in strength from magnitude 3.7 to 5.4.
A state of emergency was declared and army troops were on standby to assist after the quake, which was centered 19 miles (30 kilometers) west of Christchurch, according to GNS Science. No tsunami alert was issued.
As evening approached and a damaged historic building near the city center burst into flames, officials ordered residents to stay in their homes until Sunday morning. Parker said the curfew would help prevent people from going near about 120 inner-city buildings that were badly damaged.
Up to 90 extra police officers were flying to Christchurch to help, and troops were likely to join the recovery effort on Monday, he said.
Rescue workers also set up accommodation centers at schools in suburban areas to house hundreds of people forced out of their damaged homes, civil defense spokesman Murray Sinclair said.
Suburban dweller Mark O'Connell said his house was full of smashed glass, food tossed from shelves, with sets of drawers, TVs and computers tipped over.
"We were thrown from wall to wall as we tried to escape down the stairs to get to safety," he told The Associated Press.
Sheep farmer Paul Cowie from the town of Darfield, near the quake's epicenter, said his family was knocked to the floor.
"We couldn't stand up, but we had to run across the house to get to the kids ... and they were shaken up," he said. The family fled the house and huddled in a car parked in an open field.
GNS Science initially reported the quake as magnitude 7.4, but later revised it to 7.1. The U.S. Geological Survey measured it at 7.0.
Minister of Civil Defense John Carter said there was "a lot of damage to our key infrastructure ... water, waste water systems."
Strong infrastructure saved people
Experts said the low number of injuries reflects the country's strict building codes.
"New Zealand has very good building codes ... (that) mean the buildings are strong compared with, say, Haiti," which suffered widespread damage in a magnitude-7.0 quake this year, earth sciences professor Martha Savage said.
"It's about the same size (quake) as Haiti, but the damage is so much less. Though chimneys and some older facades came down, the structures are well built," said Savage, a professor at the School of Geography, Environment and Earth Sciences at Victoria University in the capital, Wellington.
Christchurch fire service spokesman Mike Bowden said a number of people had been trapped in buildings by fallen chimneys and blocked entrances, but there were no reports of people pinned under rubble. Rescue teams were out checking premises.
Christchurch Hospital said it had treated two men with serious injuries and a number of people with minor injuries.
One man was hit by a falling chimney and was in serious condition, while a second was badly cut by glass, hospital spokeswoman Michele Hider said.
Christchurch police reported road damage in parts of the city and cordoned off some streets where rubble was strewn about. Parked cars were crushed by heaps of fallen bricks, and roads buckled.
Civil defense agency spokesman David Millar said at least six bridges had been badly damaged and the historic Empire hotel in the port town of Lyttelton was "very unstable" and in danger of collapse. Several wharves at the port were damaged.
People in the city's low-lying eastern suburbs were told to be ready to evacuate after power, gas, sewage and water systems were cut by the quake, Police Inspector Mike Coleman said.
Kiwirail rail transport group spokesman Kevin Ramshaw said 13 trains, mostly freight, had been halted, with some damage confirmed to lines north of Christchurch.
Christchurch International Airport was closed as a precaution as experts checked runways and terminal buildings, a spokesman said.
New Zealand sits above an area of the Earth's crust where two tectonic plates collide. The country records more than 14,000 earthquakes a year - but only about 150 are felt by residents. Fewer than 10 a year do any damage.
New Zealand's last major earthquake registered magnitude 7.8 and hit South Island's Fiordland region on July 16, 2009, moving the southern tip of the country 12 inches (30 centimeters) closer to Australia, seismologist Ken Gledhill said at the time.