Al-Shabaab has been trying to overthrow the government for more than 15 years and regularly attacks civilian and military targets.
The bomber struck an education center Friday packed with hundreds of students in a Shiite neighborhood, killing 19 people and wounding 27.
The Somalia-based extremist group al-Shabab claimed responsibility for the attack.
A suicide bombing outside a voter and ID registration centre in Kabul killed at least 57 people, and injured 112 people.
The assault underscores growing concerns about security in the lead-up to legislative elections scheduled for October 20, which are seen as a test-run for next year's presidential poll.
The attackers targeted the convoy of security forces on the Sariab road in the provincial capital Quetta, they said.
The Islamic State group issued a claim of responsibility, saying in an online statement that it had carried out the attack as the Egyptian army was preparing an assault on IS positions in Sinai.
Iran on Saturday condemned a suicide bombing near Islam's holiest site in Mecca and offered Saudi Arabia its assistance in tackling terrorism despite their severed ties.
There were mixed reports, with some local news agencies reporting there was a single shooter inside the Tehran complex and others saying there were three men.