Police officer Nishat Cheema said the two men were former students of the Jamia Naeemia seminary, which Sharif visited Sunday.
Video footage of the incident showed Sharif, 68, visibly shaken by the incident.
Chairman Pakistan Peoples Party Bilawal Bhutto Zardari has strongly condemned the incident of throwing shoe at Nawaz Sharif and termed it ugly trend threatening the respect and security of the political leaders in Pakistan.
The state minister, along with Pakistan Muslim League-Nawaz leader Tallal Chaudhry, was addressing media after the Senate elections, in which the opposition-backed candidate Sadiq Sanjrani emerged victorious.
The man was immediately caught and taken into custody.
PML-N workers grabbed the man and handed him over to police. The accused, identified as Talha Munawwar, is reported to have been a former student of the seminary.
The assailant said that he was upset over the fact the Sharif's party changed a clause related to the finality of Prophet Mohammad (PBUH) in the country's constitution and hence took this step.
The incident comes days after another PML-N leader, Ahsan Iqbal, had a shoe thrown at him, making it the third incident of similar nature against the ruling party's top leadership in recent days. In Saturday's incident, Faiz Rasool, who threw ink at the foreign minister, told the police that he vented his anger because the PML-N had tried to change the finality of the Prophet in the Constitution.
The attack on Nawaz Sharif was widely slammed by all mainstream political parties, including Pakistan Tehreek-e-Insaf and religious parties calling for tolerance on varied issued from politics to religion.