The final results, announced just before midnight, gave National 59 seats and its partner ACT 5. United Future leader Peter Dunne will join them, making a total of 65.
Labour has 43 seats, the Greens eight, and they are joined by Progressive Party leader Jim Anderton for a total of 52.
The Maori Party holds five of the seven Maori seats but does not hold the balance of power in Parliament.
Miss Clark called Mr Key at 11pm to concede defeat and then told Labour supporters she was standing down and the party would have a new leader before Christmas.
"Tonight has not been our night, this is a night for the winners to savour but we won't be going away," she said.
"I respect the choice that has been made, and I accept responsibility for it."
Miss Clark said she would stay in Parliament to represent her Mt Albert electorate for the next three years.
Mr Key told cheering supporters he would form a government with ACT and Mr Dunne, and would also talk to the Maori Party which holds five seats in the new Parliament.
National does not need the Maori Party for a majority but Mr Key wants to include it in his government.
"My pledge is that I will lead a government that serves the interests of all New Zealanders," Mr Key said.
"It will recognise individual achievement and it will support those who cannot support themselves."
Mr Key acknowledged the challenges New Zealand faced and promised his new government would meet them.
"New Zealanders have voted for prosperity, for a brighter, more ambitious future," he said.
Mr Key paid tribute to Miss Clark and thanked her for gracefully conceding defeat.
New Zealand First did not reach the 5 percent it needed to hold seats in Parliament, and leader Winston Peters' long political career is almost certainly over.
Labour has lost seven of the seats it held in the last Parliament and National has gained 11.
The Greens have eight seats, two more than they previously held, although the party's 6.5 percent share of the vote was lower than polls had predicted.
The Maori Party holds five of the seven Maori roll seats. It held four in the last Parliament and has taken Te Tai Tonga from Labour.