Ashraf was the second choice to replace Yousuf Raza Gilani, who was dismissed by the Supreme Court this week for refusing to initiate a corruption investigation against President Asif Ali Zardari.
The ruling Pakistan People's Party then nominated outgoing textile minister Makhdoom Shahabuddin, but he was served Thursday with an arrest warrant for his role in a drug-import scandal. The warrant was issued by an antinarcotics force run by the military, which wields political power and has staged three coups in Pakistan's short history.
The PPP and its coalition partners elected Ashraf as prime minister by a vote of 211 to 89. Supporters thumped their hands on their desks in a show of support while PPP members in the balcony chanted "Long live Bhutto" in homage to the party's founder, Zulfiqar Ali Bhutto.
Speaking to lawmakers after his election, Ashraf said the economy, the power crisis, and inflation were his main priorities. "Our country cannot afford politics of confrontation at this time," he said.
The Gilani government, widely criticized as corrupt and inept, has done nothing to fix the country's problems.
Ashraf said he wanted to deal with the United States on an equal footing. Speaking in English in an otherwise Urdu-language speech, he also said there would be no peace in Pakistan without peace in Afghanistan.
Ashraf was head of the Water and Power Ministry for three years, an unpopular position in a country where daily blackouts in the steamy summer can be as long as 22 hours.
He has been accused of corruption relating to power projects.