Kim expressed sympathy to Iranian President Ebrahim Raisi and reaffirmed North Korea's stand in "opposing all sorts of terrorism," KCNA said.
North Korea has been under a United Nations arms embargo since it first tested a nuclear bomb in 2006.
South Korea's military conducted "corresponding" live firing drills on Friday in response to the shelling.
Russia is now closer to acquiring Iranian ballistic missiles from Tehran just days after launching North Korean-made missiles into Ukraine, according to the US.
"If the enemy opt for military confrontation ... our army should deal a deadly blow to annihilate them thoroughly," KCNA news agency quoted Kim as saying.
North Korea vowed to launch three new spy satellites, build military drones, and boost its nuclear arsenal in 2024 as leader Kim Jong Un said US policy is making war inevitable.
North Korea said it had tested its newest ICBM on Monday to gauge the war readiness of its nuclear force against mounting US hostility, drawing condemnation from the United States and its allies.
Less than half an hour after the launch, North Korean state media carried a statement from the defense ministry criticizing "military gangsters" in the United States and South Korea.
"The US side reiterated that any nuclear attack by the DPRK against the ROK will be met with a swift, overwhelming, and decisive response," a joint US-South Korean statement said on Saturday.
“North Korean leader Kim Jong Un instructed various agencies to find ways to comprehensively support Palestine in the war between Israel and Hamas,” Korea Broadcasting System reported.