Apparently, the difference is that both Iceland PM and Spanish minister were named as owners/directors of offshore companies, something that they had denied before "Panama Papers" became public. So they had to step aside when they were criticized for "lying", not for owning offshore companies.
If instead of his sons, had Nawaz Sharif been himself named as present owner of offshore companies (or accounts), then he would have been in a very weak legal position in Pakistan as not mentioning these companies among his assets in the declaration filed with Election Commission, would have meant disqualification.
Right now, he is facing political problems. But legally he is OK so far as he has not been personally named in Panama papers.