The killed included 11 female university students, a senior government official, three security personnel, four nurses and one civilian, Xinhua quoted police officer Mir Zubair as saying.
Four militants were also killed in the attacks and one suspected militant was arrested, he said.
According to police and media reports, a remote-controlled bomb fixed on a university bus went off at about 2.50 p.m. when students and staff members of Sardar Bahadar Women University were boarding it to go back home.
A huge fire broke out following the blast, leaving the bus burnt out, witnesses told the media.
All the bodies and injured were shifted to the Bolan Medical Complex.
As the hospital was busy with the rescue of the injured, a bomb went off reportedly outside an intensive care unit there, killing Quetta Deputy Commissioner Abdul Mansoor Khan and another civilian.
Khan was paying a visit to the blast victims at the hospital. Following the blast, fierce firing was reported inside the hospital.
Five heavily armed militants launched an attack at the people inside the hospital.
Apparently they were targeting the officials coming to visit the blast victims, said police.
A large contingent of security personnel was called in and a total of 300-plus security personnel were involved in the operation against the militants.
During the operation, three security personnel and four nurses were killed and four militants were also killed, said police.
Two of the militants blew themselves up, one at the entrance of the hospital and another on the second floor of its main building, and another two were shot dead during the exchange of the fire.
Pakistan President Asif Ali Zardari and Prime Minister Nawaz Sharif condemned the attacks.
This is the most serious terror attack in Pakistan since Sharif assumed office June 5.