The pledge of military cooperation was part of a strategic treaty signed during a summit in Pyongyang, where Putin was making his first visit in 24 years.
"It is really a breakthrough document," Putin told a news conference in the North Korean capital, adding that it provided, "among other things, for mutual assistance in case of aggression against one of the parties to this treaty", Russian news agencies said.
The two countries have been allies since North Korea's founding after World War II.
Putin also said Russia "does not rule out military-technical cooperation with the DPRK in connection with the treaty that was signed today", referring to North Korea by its official name.
Kim called Putin the "dearest friend of the Korean people" and said his country "expresses full support and solidarity to the Russian government" over the war in Ukraine.
Putin, in turn, thanked his host Kim -- whose country has been under a UN sanctions regime since 2006 over his banned weapons programmes -- saying Moscow appreciated the "consistent and unwavering" support.
Putin said the two heavily sanctioned countries would not tolerate Western "blackmail" and called for a review of UN sanctions on North Korea.
"The indefinite restrictive regime inspired by the US and its allies at the UN Security Council towards the DPRK should be reviewed," Putin said.
Putin also said Moscow and Pyongyang were fighting "US hegemony" together and commended the North for its "balanced position" on Ukraine.
- Red carpet -
Putin arrived in Pyongyang before dawn on Wednesday and was greeted by Kim on a red carpet at the airport, where the pair embraced and smiled.
They then attended a welcoming ceremony in Kim Il Sung Square, featuring a military band and mass synchronised dancing, after which Putin invited his host to visit Moscow.
The summit, which included a lengthy one-on-one chat between the leaders, was their second meeting in a year.
Kim took his bulletproof train to Russia's Far East in September for a summit with Putin at a spaceport.
Kim said the two countries' ties had now risen "to a new high of alliance".
"It is greatly satisfying to conclude a great treaty that befits a changed international situation and the strategic nature of new DPRK-Russia relations," he said.
Kim also said the new treaty "fully contributes to maintaining peace and stability in the region".