After a third ballot Spain won the second seat with 132 votes to Turkey's 60.
Mr Key also paid tribute to efforts by Foreign Minister Murray McCully, "who's literally been to all of the 190 countries that could have voted in this particular campaign".
New Zealand's UN ambassador to the UN Jim McLay and his team had done a "tremendous job" as had the Ministry of Foreign Affairs and Trade, he said.
Mr Key also thanked the Opposition for their support including Phil Goff and David Shearer.
NZ First Leader Winston Peters said Mr McCully and Mfat should be complimented for securing the seat "in clearly difficult circumstances, against much more internationally prominent and populist opponents".
"Many will question the cost of this campaign but should measure that against the confidence that many smaller nations like New Zealand will have in our presence there at a time when serious reform of the United Nations is required."
A member casts his country's vote. Photo / AFP
PM: 'Victory for the small states'
Earlier, Mr Key said the win was "a victory for the small states that make up over half the United Nations membership".
"We have worked very hard on the bid for close to a decade because we believe that New Zealand can make a positive difference to world affairs and provide a unique and independent voice at the world's top table."
"Our win proves small countries have a role to play at the UN and we are determined to represent the perspective of small states at the Security Council."
He said the Security Council faced a number of challenging issues.
"New Zealand is looking forward to serving on the Council and making a positive contribution throughout our two-year term."
New Zealand's Jim McLay reacts after NZ was elected. Photo / AFP
McCully's 'sense of relief'
Murray McCully told the Herald from New York after the vote that he had "an enormous sense of relief."
"We've invested a lot of time and energy in presenting our credentials to the member states and to win on a first ballot against two of the big heavyweights is tremendous feeling."
He said a lot of people in New York had been watching the campaign as "somewhat of a litmus test" of whether a small country that campaigns well really can make it against countries with bigger resources.
"We are very focused now on making a good fist of this. The membership have just given us a resounding vote of confidence and we have got to make sure we live up to it."
New Zealand was last on the council 20 years ago.
The campaign for a seat began in 2004 under Labour Prime Minister Helen Clark who is now No 3 at the UN as head of the United Nations Development Programme.
Mr McCully said he could not say yet how much New Zealand spent on the bid and there had never been a separate budget for it.
"We have done this inside our budget and it was a reduced budget and it is a budget that we have been under-spending."
"Nothing extravagant has been done to win this campaign."
Mr McCully paid tribute to the New Zealand team in New York led by ambassador Jim McLay, who had done "a terrific job" as had special envoys, officials and others working in capitals around the world.
He said Mr McLay would take New Zealand's seat on the Security Council although he and Prime Minister John Key may attend for ceremonial occasions.
Mr McCully said it was important for New Zealand to represent smaller countries at the council table.
"It's got much harder for smaller countries to serve [on the Security Council] and one of the reasons it was important for us to get there is not just because New Zealand, I think, can bring some qualities to the council, but also because smaller countries are being squeezed out of the reckoning," he said on Radio New Zealand this morning.
"A lot of small countries were hoping we were going to get up today."
New Zealand could make a difference, he told the broadcaster.
"It's a good thing because we obviously have some strong views about the trouble spots of the world and particularly the inability of the UN security council to find a way of dealing with most of them," Mr McCully said.
"I've been fairly critical and so has the Prime Minister in that respect, so if you're going to criticise you have to put yourself forward and say, 'we'll help fix this'.
"But it's also I think, from a more selfish point of view, sitting on the council has you sitting at the big table with the big players. It does give you a chance to advance your interests, talk to countries about relationships in the trade and economic area and so on, but we also think we can help New Zealand's interests as well."
Shearer congratulates MFAT team, McCully
Labour foreign affairs spokesman David Shearer congratulated Mr McCully and the Ministry of Foreign Affairs and Trade team.
"Coming through with 145 votes on the first ballot is a testament to the campaign but also the way we are held in the world I think.
"I want to congratulate the Foreign Affairs team that did so much hard work but also the efforts spear-headed by Murray McCully. It was a very good job."
Mr Shearer made two trips to New York at Mr McCully's invitation to campaign at the United Nations where he formerly worked in delivering humanitarian relief.
Mr Shearer said it was now up to New Zealand to deliver on it campaign commitments.
"The big thing is we have got to make good now on our promises to people and that really was to listen to everybody and make decisions based on the merits of the case, not necessarily on big and powerful interests and have a genuinely open door for small states who often don't get a chance on the Security Council."
David Shearer has congratulated Mr McCully and Mfat. Photo / Glenn Taylor
Mr Shearer told TVNZ's Breakfast show the win reflected how New Zealand was seen around the world.
"We're seen as fair-minded and independent and a good player, if you like."
Now there were two years where New Zealand would have a seat at the "most powerful table" in the world, he said.
"Look at the things we're going to have to be focused on, we've got obviously the Ebola stuff...the Eastern Ukraine and most important probably, what's happening in the Middle East."
- additional reporting APNZ