"The reasons behind the fatal shooting in Ottawa this morning are not yet known, but it is clearly a senseless act of violence," Xinhua quoted Key as saying in a statement.
"I wish to extend New Zealand's sincere condolences to the people of Canada who will be shaken by this violent act. I will personally extend those thoughts and wishes to Prime Minister ( Stephen) Harper," he said.
"New Zealand and Canada have a long standing warm and close relationship and today we stand beside them in solidarity."
Parliament Hill in Canada's capital Ottawa came under attack Wednesday after a gunman shot dead a soldier standing guard at the National War Memorial, before seizing a car and driving to the doors of Parliament Hill's Centre Block nearby.