Sgt Danny Nightingale said outside court after being released: "Thank you to the world for being so kind".
His wife Sally said she was "very, very happy" and that she had "fought for this and got justice today".
More top news
South Korea's intelligence agency, which has a mixed record when it comes to North Korea, made the allegations.
More than 500,000 pieces of patients' confidential medical correspondence - including cancer diagnoses - have been mislaid by the NHS.
Corporation demands 'urgent investigation' into claims that outsourced enforcement staff targeted vulnerable people for fees.