The declaration also included an agreement to make "joint efforts" to ensure the implementation of the six-nation agreement ending North Korea's nuclear weapons programmes.
The declaration marked the first time the North Korean leader has personally put his name to denuclearisation efforts.
"At last the leaders of both republics have enough guts to leap over their differences and remember their bloodline"
Send us your views
"Now that the highest leader of North Korea has confirmed a clear commitment to the North's nuclear dismantlement, I don't see any problem in carrying it out," Roh said after returning to South Korea.
"I firmly believe that the six-party talks will proceed well without any obstacles."
Ban Ki-moon, the UN chief and a former South Korean foreign minister, commended the commitment of the two leaders to advance inter-Korean relations and "move towards permanent peace on a non-nuclear peninsula", a spokeswoman said in New York.
The historic summit in Pyongyang was only the second ever meeting between the leaders of North and South Korea in more than half a century.
Under the declaration, the two leaders also pledged to create a joint fishing zone along their disputed sea border – a frequent source of tensions between the North and South.
North Korea has never recognised the sea border, which was drawn unilaterally by United Nations forces after the Korean War.
In other points, the two leaders also agreed they would hold "frequent" future summits - although no timing for any such encounters was given - and they agreed to increase cross-border family reunions, saying they would hold such meetings "constantly".
The issue of divided families is a deeply emotional one in both countries.
Kim shook hands with Roh, smiled and clinked glasses of champagne after signing the agreement.
Brink of war
Work to sign peace treaty along with the US and China to formally end Korean War
Co-operate to end military hostilities and ensure peace
Establish common fishing zone around disputed western sea border.
Ensure international agreements on North Korea's nuclear weapons programmes are fully implemented
Promote economic co-operation, including establishing cross-border rail freight service and building cooperative ship-building complexes
Open an air route from South Korea to culturally significant Mount Paektu
Send joint "cheering squads" to the 2008 Beijing Olympics
Expand reunions of separated families
North and South Korea have stood on the brink of a return to war for more than five decades, ever since the Korean War was brought to a halt with a ceasefire in 1953.
In the declaration signed in Pyongyang, Roh and Kim agreed that a more formal end to hostilities must be put in place.
"North and South Korea shared the view they must end the current armistice and build a permanent peace regime," they said.
The two leaders also said that both sides had "agreed to closely co-operate to end military hostility and ensure peace and easing of tension on the Korean peninsula".
However, while an agreement to push for a formal end to the war is a significant step forward, any actual treaty will also have to include China and the US, both of which fought in the Korean War.
The US still has more than 30,000 troops based in South Korea.
As for South Korea itself, it was never a signatory to the original armistice.
Question of trust
|Roh attended a performance of the mass |
games at Pyongyang's May day stadium [AFP]
Interviewed by Al Jazeera, Brian Bridges, a professor of political science at Lingnan University, Hong Kong, said the agreement suggested the North Korean leader was "coming out of his shell" and becoming more engaged.
"North Korea is in a difficult economic situation," he said, "and Kim Jong-il has to face the reality of how to get aid, how to get foreign investment into his country to raise the living standards of his people.
"To do that it requires dialogue and engagement and giving up some of the nuclear weapons or nuclear processes that he has been involved so far."
Melissa Chan, Al Jazeera's correspondent in South Korea, said that while the declaration does include some concrete steps, it is unlikely to silence all of Roh's critics at home in South Korea, many of whom say the North cannot be trusted to keep its word.
She said that the first inter-Korean summit in 2000 produced a joint declaration saying the two sides would meet more regularly and work towards re-unification – but it took seven years before another summit took place.
South Korea's main opposition Grand National Party was quick to register its disapproval of the summit, calling the joint declaration "insufficient".
In a statement the party, which is preparing for presidential elections early next year, said it was "very regrettable" that the two leaders "didn't take any substantial measures or show their firm commitment to nuclear dismantlement and peace on the Korean peninsula".