The final Test was scheduled to start on Saturday.
"A joint decision between NZC and the @BCBtigers has been made to cancel the Hagley Oval Test," the New Zealand team tweeted, adding that all players and officials were safe.
Our heartfelt condolences go out to the families and friends of those affected by the shocking situation in Christchurch. A joint decision between NZC and the @BCBtigers has been made to cancel the Hagley Oval Test. Again both teams and support staff groups are safe.
— BLACKCAPS (@BLACKCAPS) March 15, 2019
Entire team got saved from active shooters!!! Frightening experience and please keep us in your prayers #christchurchMosqueAttack — Tamim Iqbal Khan (@TamimOfficial28) March 15, 2019
Bangladeshi players and team staff arrived at the city's Masjid al Noor for Friday prayers as a shooting unfolded and were warned not to go inside.
"We are shocked and appalled, as I'm sure all New Zealanders are," NZ Cricket chief executive David White told TVNZ.
"I have spoken to my counterpart in Bangladesh and we both agree that it's inappropriate to play cricket at this time."
Bangladesh Cricket Board spokesman Jalal Yunus said most of the team were bussed to the mosque and were about to go inside when the incident happened.
"They were about to enter the mosque for prayers and they have seen I believe, by the time the incident is going on inside they have heard the sound of the shootings and they couldn't enter the mosque and from there they all went back to the stadium," he told 1 NEWS.
"They're very much shocked, they are very much shocked because they have not seen this kind of - They have never been involved in this kind of situation and they have not seen this kind of you know incidence and to see this kind of thing happening in front of them."
Bangladesh Team Manager Khaled Mashud said the entire incident felt like a movie, with people bleeding and running out of the building.
"It was like a movie, bleeding people running out of the building. We were on the bus floor for about 10 minutes," Mashud told reporters in Christchurch.
"We were very close to the mosque. We could see the mosque. We are lucky in the sense that if we had arrived three four minutes earlier, we would have been in the mosque and then it could have been a massive accident.
"We were lucky that we were not inside but from outside we saw it and it was quite similar to a movie. We saw people coming out of the mosque covered in blood. We were in the bus for eight to 10 minutes and we were lying down inside." The team stayed in the bus for a while before deciding to walk to Hagley Oval from where they were escorted to the hotel safely.
"We felt if they saw us inside the bus they might come out and attack. At that point, the players decided that they should get out of the bus and quickly walked out," he revealed. "We stayed in the dressing room for a while and we were discussing how we can get out. The New Zealand board was trying to bring us back to the hotel safely. They tried their best in this regard and they cannot be blamed because they tried in the manner they are used to. I think the players supported each other at that point and took a wise decision of getting out from the bus. Thank you NZ cricket board for bailing us during that time and making arrangements so that we could return to the hotel safely.
"Our plan to return has also been chalked out with the people in charge. The board has been in communication with us. Not just with me, but also the captain Mahmudullah and Tamim and the coach. I would like to thank the cricket board for monitoring the situation and giving us their inputs."
Meanwhile, opening batsman Tamim Iqbal wrote on Twitter: "Entire team got saved from active shooters!!! Frightening experience and please keep us in your prayers."
Alhamdulillah Allah save us today while shooting in Christchurch in the mosque...we r extremely lucky...never want to see this things happen again....pray for us
— Mushfiqur Rahim (@mushfiqur15) March 15, 2019
The decision to call off the match was supported by ICC chief executive David Richardson.
“Our thoughts and sincere condolences go out to the families and friends of those affected by this horrendous incident in Christchurch. Both teams, staff and match officials are safe and the ICC fully supports the decision to cancel the Test match,” he said.
Local media said there were multiple casualties at one mosque and that another had been evacuated.
The attack was described by prime minister Jacinda Arden as "one of New Zealand's darkest days".
(With inputs from AFP)